Rico
Rico

Reputation: 1298

Asp.net Gridview is Crashing when I load 25000 records into it

I am loading 25000 records into my gridview with 70 Columns and it is crashing.

Why is it crashing?

Upvotes: 1

Views: 2441

Answers (1)

Brian Webster
Brian Webster

Reputation: 30865

Gridviews are known to cause an out-of-memory exception when displaying tens of thousands of rows (1.7 million cells, in your case).

You may consider setting EnableViewState to False; that is, if you don't plan on allowing editing.

If your application requires you to write 25k results to the screen and you are constrained from using paging, then you should probably be emitting text to the screen via dumping the contents of a StringBuilder into a Literal, rather than using a Gridview.

With that said, everything points to a broken design. There are very few legitimate reasons to dump that many records into a webpage.

Upvotes: 7

Related Questions