Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid - grabbing info on rows

Status
Not open for further replies.

overDeveloper

Programmer
Dec 11, 2006
58
US
I am trying to find some easy ways to grab row count info on a paging data grid. bascially, I am wanting to make a "You are viewing items 25-50 of 728"

I can gab the "728" via xxx.tables["yyy"].Rows.Count but I need to find a way to grab the count of the first item (I can then just add 25 to it for the second....)
 
You can use a combination of the PageSize, PageCount and PageIndex to work those values out.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
A little math will do ya, as ca8msm has said:

psuedo code:
Code:
DataGrid1_PageIndexChanged event

Dim pageSize As Integer = DataGrid1.PageSize
Dim currPage, total, rowFrom, rowTo as Integer

total = pageSize * (e.NewPageIndex + 1)
rowFrom = total - pageSize + 1
rowTo = total
Jim


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top