Click here to Skip to main content
15,066,928 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear,

I am facing system.outofmemmory exception when binding a gridview with a datatable having more then 400000 records please find the below sample code for the same
GridView gv = new GridView();
this.EnableViewState = false;
gv.DataSource = (DataTable)dt;
gv.DataBind();

Kindly help me to overcome in this situation is there any limitation of gridview for databind?
Posted
Comments
Sandeep Mewara 28-Sep-10 16:06pm
   
Heard of Pagination?

400000 records in gridview in asp.net!!!! and you want to show it to your user!!
I think you have to reconsider what you are doing.I am not sure if the browsers support this volume of data.
I think it is better to split it in pages.
   
C++
datatable having more then 400000 records please

This is good way show the data in grid. Not, only on grid, I will say anywhere. Did you think about the performace of the page ? And what to do you 400000 data at time. Try to use filter and show only those data which needed. Don't go for showing this amount of huge data.
   
Comments
Sandeep Mewara 28-Sep-10 16:07pm
   
Looks like he missed that Grid's can have custom pagination...

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