简体   繁体   English

PostBack上的ASP.NET GridView'找不到页面'

[英]ASP.NET GridView 'Page Not Found' on PostBack

I have a GridView that (in one particular instance) would contain about 5000 rows, each row containing a DropDownList with about 5000 items. 我有一个GridView(在一个特定的实例中)将包含约5000行,每行包含一个包含约5000个项目的DropDownList。 Naturally, this takes forever to load and throws and OutOfMemory exception on my box. 自然,这需要永久加载并在我的盒子上抛出OutOfMemory异常。

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. 好吧,当它绑定到其他数据时,它可以很好地工作(对于相同的gridview),但是当我将其绑定到这个特定的DataSource(具有5000行的数据源)时,就会出现问题。

When I first load the GridView with the offending DataSet, page one displays just fine. 当我第一次使用有问题的DataSet加载GridView时,第一页显示得很好。 However, when I click to view page two I get the error: 但是,当我单击以查看第二页时,出现错误:

Error 101 (net::ERR_CONNECTION_RESET): Unknown error. 错误101(net :: ERR_CONNECTION_RESET):未知错误。

In Google Chrome. 在谷歌浏览器中。

And the error: 错误:

Internet Explorer cannot display the webpage

In IE. 在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. 回发需要花费更长的时间,因为它必须处理ViewState ...这将是绝对巨大的。

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. 如果您绝对肯定要在下拉菜单中有5000个选项,请将该下拉菜单移到GridView之外,这样它就不会出现在每一行中。 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. 您甚至可能会抛出一个JavaScript hack,将选择时的下拉列表移动到该行,以使该下拉列表似乎出现在每一行中,但实际上只有一行。

Look in the event viewer where IIS is running and you'll see any unhandled ASP.NET errors. 在运行IIS的事件查看器中查看,您会看到所有未处理的ASP.NET错误。

Also a drop down with 5000+ entries doesn't seem like an optimal choice for a control... 此外,具有5000多个条目的下拉列表似乎不是控件的最佳选择...

Instead of retrieving the 5000 rows just retrieve the ones you will show on the page. 无需检索5000行,只需检索将在页面上显示的行即可。

Also a drop down with 5000+ entries doesn't seem like an optimal choice for a control... 此外,具有5000多个条目的下拉列表似乎不是控件的最佳选择...

+1 +1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM