views:

285

answers:

3

I have a GridView that (in one particular instance) would contain about 5000 rows, each row containing a DropDownList with about 5000 items. Naturally, this takes forever to load and throws and OutOfMemory exception on my box.

No big deal, I thought. I'll just enable paging.

Well, that works fine (for the same gridview) when its bound to other data, but when I bind it to this particular DataSource (the one with 5000 rows) problems arise.

When I first load the GridView with the offending DataSet, page one displays just fine. However, when I click to view page two I get the error:

Error 101 (net::ERR_CONNECTION_RESET): Unknown error.

In Google Chrome.

And the error:

Internet Explorer cannot display the webpage

In IE.

Any thoughts on why this is happening would be greatly appreciated.

+2  A: 

Look in the event viewer where IIS is running and you'll see any unhandled ASP.NET errors.

Also a drop down with 5000+ entries doesn't seem like an optimal choice for a control...

Chris Marisic
+1 when is showing a user that much data ever practical... or performant...
Achilles
Agreed, you should look into externalizing that dropdown (from the gridview) somehow.
Steve Danner
The idea behind the project is that a client has two lines or products and each product has about 10 attributes. This one particular attribute takes one of about 5000 values and they want to be able to map the attribute X with value A (of the 5000) in line one to the attribute X with value B (of the 5000) in line two.I'm certainly open to ideas on a better control setup would be. Because I'm not really thrilled about this one to start with.
A: 

Instead of retrieving the 5000 rows just retrieve the ones you will show on the page.

Also a drop down with 5000+ entries doesn't seem like an optimal choice for a control...

+1

pedro
+1  A: 

This is probably just a timeout issue. It's taking much longer on postback because it has to process the ViewState... which will be absolutely huge.

Like others have said, your implementation needs a re-think.

Are these options organized alphabetically? If so, what about a fairly straightforward autocomplete? Type two letters and then get a popup of available options that start with those two letters. The Yahoo library has a decent implementation of this.

If you absolutely positively have to have 5000 options in a dropdown... move this dropdown outside the GridView so that it doesn't appear on every row. Basically, the user will select a row, and then use this single "master" dropdown to select the data. You could probably even throw in a javascript hack that moved the dropdown into the row on selection so that it appears the dropdown is in every row, but there is really only one.

Bryan
Super-helpful idea. Thanks!