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 particul开发者_JAVA百科ar 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.
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.
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...
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
精彩评论