使用动态数据时,为什么我的视图状态在回发之间不断增长?

发布于 2024-07-25 10:14:17 字数 294 浏览 3 评论 0原文

我正在使用 ASP.NET 动态数据编写一个非常复杂的 Web 表单。 由于控件之间存在依赖关系,因此该表单上的几个控件会回发。 我注意到视图状态随着每次回发而变得越来越大,直到大约 5 年后,渲染过程和 Web 浏览器中实际加载的页面之间存在很长的延迟。

即使我只是单击单选按钮来引起回发,而不在表单中输入任何数据或任何其他更改,也会发生这种情况...

我检查了旧版本的表单,它不使用动态数据和视图状态根本不增长...所以我推测动态数据控件在某种程度上应该受到指责...

其他人看到过这个吗? 有解决办法吗?

I'm writing a pretty complex web form using ASP.NET Dynamic Data. Several of the controls on this form post back, since there are dependencies between controls. I'm noticing that the viewstate is growing larger with every postback, until after 5 or so there is a long delay between the Render process and the page actually loading in the web browser.

This occurs even if I'm JUST clicking a radio button to cause the postback, without entering any data or any other changes into the form...

I checked the older version of the form, which does not use Dynamic Data, and the viewstate doesn't grow at all... so I'm theorizing that the dynamic data controls are somehow to blame...

Anyone else seen this? Is there a fix for it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

看海 2024-08-01 10:14:17

我不知道您的问题的直接答案,但也许这些工具之一可以帮助您进一步诊断:

(1) Fritz Onion 的 ViewState Decoder 工具也许能够帮助您弄清楚里面塞满了什么。 您可以在 Pluralsight 工具页面 中找到列出的 ViewSate Decoder。 直接下载链接:ViewStateDecoder22.zip

ViewState 解码器屏幕截图 http://alt.pluralsight.com/images/decoderscreenshot.gif

(2) 另一个可能值得关注的工具是 ASP.NET ViewState Helper

“[...] ASP.NET ViewState Helper 是
旨在帮助所有网络开发人员,
但有特定的功能可以提供帮助
ASP.NET 开发人员调试 ViewState
问题。 分析您的网页
当您使用浏览它们时实时
Internet Explorer 6.0 或更高版本。
[...]”

I don't know the direct answer to your question, but perhaps one of these tools may help you diagnose further:

(1) Fritz Onion's ViewState Decoder tool might be able to help you figure out what's getting stuffed in there. You can find ViewSate Decoder listed at the Pluralsight Tools page. Direct download link: ViewStateDecoder22.zip.

ViewState Decoder screen shot http://alt.pluralsight.com/images/decoderscreenshot.gif

(2) Another tool that may be worth looking at is ASP.NET ViewState Helper:

"[...] ASP.NET ViewState Helper is
designed to help all web developers,
but has specific features to help
ASP.NET developers debug ViewState
issues. Analyze your web pages in
real-time while you browse them using
Internet Explorer 6.0 or higher.
[...]"

难以启齿的温柔 2024-08-01 10:14:17

好吧,罪魁祸首是 Telerik 的 RadComboBox。 更具体地说,是缺乏对使用 RadComboBox 的动态数据的支持。 更具体地说:

将 RadComboBox 与 DynamicData 结合使用的解决方法是将可见设置为 false 的 DropDownList,在该 DDL 上调用 PopulateListControl,然后将项目复制到 RadComboBox。

这工作得很好,除非你在每次回发时都这样做......我猜当你这样做时,它会将整个列表填充到 Viewstate 中,并且由于我每次回发都这样做......视图状态不断增长。

Ok, so the culprit was Telerik's RadComboBox. More specifically, it was the lack of support for Dynamic Data using RadComboBox. To be even MORE specific:

The workaround for using a RadComboBox with DynamicData is to have a DropDownList with visible set to false, call the PopulateListControl on that DDL and then copy the items to RadComboBox.

This works fine, except when you do that on every postback... I'm guessing it stuffs the entire list into Viewstate when you do it that way, and since I was doing it every postback... the viewstate kept growing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文