Too many rows in a gridview?

  • Thread starter Thread starter cowznofsky
  • Start date Start date
C

cowznofsky

I have a gridview which I load with about 50 rows of high-level data,
and include a link on each row which will drill down and reload the
gridview. I have some buttons on the page which provide some other
functionality, such as exporting the contents of the gridview to excel
(using my own code).

This typically works fine, but now I find that if I have a high number
of rows of the low-level data, say about 5000, then the page does not
work correctly.

If I hit the button to send he results to excel, the page_load event
is not reached, and I get the generic "The page cannot be displayed".
Hitting a different button raises a popup box with the message
"response text had 0 length".

I assume that I've exceeded some maximum for the viewstate.
 
I believe you can disable the grid's viewstate provided you don't allow
editing. That's only a quick fix though since you should never display 5K
rows all at once. Use the grid's built-in paging functionality, unless
you're using a separate application server to get the data. In that case you
may want to build paging into the web service or query itself.

Paul
 
Back
Top