Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All, I am facing a problem.

The problem is that, i have a simple aspx page with a gridview and two dropdowns for State and Districts. On page load within !ispostback the gridview is binded with about 3000 records from database. On selectedindexchanged of State dropdown the district dropdown is binded (gridview is not binded this time). But it takes so much time to populate the districts.

But if in the pageload, the gridview is binded with 100-200 records (selecting 100-200 records from database) in that case the district is populated within a second.

I cannot figure out what exactly the problem is.So Please help me.
Posted
Comments
virusstorm 19-Jun-15 10:38am    
Your problem is you are binding 3000 records. This is a lot of data to bind and display. You need to implement paging.
sunilsourav 29-Jun-15 10:20am    
Hi,Thanks a lot for your suggestion. Now i have resolved it by extracting only 10-20 records at a time with dynamic paging implementation.

The simple solution is: don't try to load so many records.

Of course it takes time to load: 3000 records is a lot of text to pump across the internet (with appropriate HTML wrapping). And to make things worse, do you expect your users to find their record easily in that lot?

Only ever populate a user control with around 100 rows at most, and provide paging, searching, and filtering: it's faster, easier and a lot more user friendly!
 
Share this answer
 
Comments
Richard Deeming 19-Jun-15 11:37am    
Not to mention the time it takes to post the ViewState back to the server, and for the server to deserialize the state and re-hydrate the 3000-record GridView and all of its child controls! :)
OriginalGriff 19-Jun-15 11:41am    
But...but...it's easy for me to codezzzzz!
:laugh:
sunilsourav 29-Jun-15 10:20am    
Hi,Thanks a lot for your suggestion. Now i have resolved it by extracting only 10-20 records at a time with dynamic paging implementation.
OriginalGriff 29-Jun-15 10:34am    
You're welcome!
I suggest you to build your grid view along with bootstrap data table plug-in. https://datatables.net[^]

This will automatically handle paging, sorting and filtering. Also very quick. Give it a try.

If you can't avoid asp.net view state try using bootstrap data table or else do paging instead of loading all data at once.
 
Share this answer
 
Comments
sunilsourav 29-Jun-15 10:18am    
Hi,Thanks a lot for your suggestion. Now i have resolved it by extracting only 10-20 records at a time with dynamic paging implementation.
Sreekanth Mothukuru 30-Jun-15 0:41am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900