ASP.NET GridView“找不到页面”回发时
我有一个 GridView(在一个特定实例中)将包含大约 5000 行,每行包含一个包含大约 5000 个项目的 DropDownList。当然,这需要永远加载并在我的盒子上抛出 OutOfMemory 异常。
没什么大不了的,我想。我将启用分页。
好吧,当它绑定到其他数据时,它工作得很好(对于同一个 gridview),但是当我将它绑定到这个特定的数据源(具有 5000 行的数据源)时,就会出现问题。
当我第一次使用有问题的数据集加载 GridView 时,第一页显示得很好。但是,当我单击查看第二页时,出现错误:
错误 101(net::ERR_CONNECTION_RESET): 未知错误。
在谷歌浏览器中。
错误:
Internet Explorer cannot display the webpage
在 IE 中。
任何关于为什么会发生这种情况的想法将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能只是一个超时问题。回发需要更长的时间,因为它必须处理 ViewState...这绝对是巨大的。
正如其他人所说,您的实施需要重新思考。
这些选项是按字母顺序排列的吗?如果是这样,那么一个相当简单的自动完成怎么样?输入两个字母,然后弹出以这两个字母开头的可用选项。雅虎库对此有一个不错的实现。
如果您绝对必须在下拉列表中包含 5000 个选项...请将此下拉列表移到 GridView 之外,以便它不会出现在每一行上。基本上,用户将选择一行,然后使用这个单一的“主”下拉列表来选择数据。您甚至可以添加一个 javascript hack,将下拉列表移动到选择的行中,这样看起来下拉列表就在每一行中,但实际上只有一个。
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.
查看运行 IIS 的事件查看器,您将看到任何未处理的 ASP.NET 错误。
另外,包含 5000 多个条目的下拉列表似乎不是控件的最佳选择......
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...
无需检索 5000 行,只需检索将在页面上显示的行。
+1
Instead of retrieving the 5000 rows just retrieve the ones you will show on the page.
+1