无法加载viewstate。控制树变成...... *叹气*你知道其余的。 [英] Failed to load viewstate. The control tree into ... *Sigh* you know the rest.

查看:77
本文介绍了无法加载viewstate。控制树变成...... *叹气*你知道其余的。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哦,小提琴! asp.net Viewstate / control树异常,无法加载viewstate。正在加载viewstate的控件树必须匹配控件树......几乎完全使用动态加载的控件构建的表单是间歇性的痛苦。



我把它缩小到控件的子树,但是回发上的子树转储看起来与最初创建表单。我希望发现丢失的控件或一个或多个插入,但没有快乐。所以我有点疑惑为什么加载器认为存在不匹配。



我试过将控件加载从页面加载事件处理程序移动到页面初始化处理程序,看看在加载viewstate之前加载控件是否有帮助,再次无济于事。



我认为使用LoadViewStateByID属性不会有助于工作出了什么事,因为控件添加了GUID派生ID



我不能在这里发布相关代码,这是工作的东西,我很欣赏这样做很难找出可能发生的事情,但是如果有人可以建议任何进一步的途径,那将会有所帮助。



我尝试了什么:



这只是为了满足发布验证。见上文。

解决方案

这很有趣。在某些情况下,在回发时虽然控制树结构没有添加或删除任何内容,但页面正在重新加载,以至于它期望找到空的视图状态,但却发现已填充的视图状态。


Oh fiddlesticks! The asp.net Viewstate/control tree exception, "Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree..." on a form that is almost entirely built using dynamically loaded controls is being an intermittent pain.

I've narrowed it down to a sub-tree of the controls, but a dump of that sub-tree on postback looks to be identical to that on initial creation of the form. I was hoping to spot either missing controls or one or more insertions, but no joy. So I'm a bit puzzled as to why the loader thinks there's a mismatch.

I've tried moving the control load from the page load event handler to the page init handler to see if loading the controls before viewstate is loaded would help, again to no avail.

I don't think using the LoadViewStateByID attribute is going to help work out what's going on because the controls are added with GUID derived IDs

I can't post the relevant code here, it's work stuff, which I appreciate does makes it difficult to work out what might be going on, but if anyone can suggest any further avenues to pursue that would be helpful.

What I have tried:

This is just to satisfy the posting validation. See above.

解决方案

Well that was interesting. In some cases on postback that although the control tree structure had had nothing added or removed the page was being reloaded in such a way that it was expecting to find empty viewstate but was finding already populated viewstate.


这篇关于无法加载viewstate。控制树变成...... *叹气*你知道其余的。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆