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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# GridView iterate over non displayed rows 1

Status
Not open for further replies.

Qik3Coder

Programmer
Jan 4, 2006
1,487
US
I have a standard grid view with 100 items in it.
I have the page size set to 25.

I need to inspect all items to get a full total of all items in the grid, not just the items on page 1.

I already have a foreach that iterates over the row collection, but this only iterates over the first 25.

TIA,
Lodlaiden



I haz all the letters: SME, BA, QA, PM, DEV, DBA, UAT, SE, HD
 
You should be iterating over the datasource of the grid, not the grid itself.
 
it would be more efficient, and scalable to
1. query a page of 25 records
2. query for the total number of records (to render paging links)
3. query for the calculated value

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
That was a contrived example.

I'm dynamically generating filter dropdowns based on the current data set.

I thought about creating queries for each of these, but didn't want to dupe the logic that gets the base data set.

Thanks,
Lodlaiden

I haz all the letters: SME, BA, QA, PM, DEV, DBA, UAT, SE, HD
 
if the results are small then you won't have a problem, but if you get into hundreds of records you will start to see performance degrade, at which point you will need to reduce the amount of data retrieved from the database

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top