Click here to Skip to main content
15,067,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

When I am binding more than 50000 records datatable in gridview application getting struck. Please how to solve it? I am using update panel for this gridview.

Hi there,

First things first, 50000 records?? I highly doubt any USER would make use of such amount of data. If you still want to show this much data, change the presentation, go for something like a summary that displays the information you need to show.

Secondly, I have no idea why you don't want to use paging but you say you don't, so no paging it is. You simply has to do code to perform the logic below.
1. Create a empty data set and bind it to the gridview.
2. Create a thread which reads data from the database in chunks and add to the dataset. I'd recommend 1000 - 5000 records at once if the database server exists in the same network. If it is over internet, limit to 500 - 1000 at once.

One thing to remember is that pulling this many records always puts stress on the network, client computer and the database server. So if there is going to be many instances of the program be running simultaneously, caching is highly recommended.

Hope this helps, regards
Member 7684075 22-Mar-12 5:05am
Thank you PasanRatnayake. Whatever you mentioned there i accept. But i want bind 50000 records at time in gridview without any paging. Anywayt thank you for you.
can you try enabling paging in grid?
Member 7684075 22-Mar-12 3:29am
No I dont want paging.. I want just bind a datatable to gridview.

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