找回密码
 FreeOZ用户注册
查看: 2874|回复: 1
打印 上一主题 下一主题

解决错误:Failed to load viewstate

[复制链接]
跳转到指定楼层
1#
发表于 15-12-2008 17:26:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除, 无法发言

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?FreeOZ用户注册

x
Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

我安排了一个ListView,又增加了一个DropDownList对ListView里的数据进行筛选。DropDownList里增加了 AutoPostback,每次从下拉菜单里选择一个值,页面自动post,刷新返回我筛选的结果。
页面引导以后,第一次筛选可以,再次筛选,报错如上。

解决方法:设置ListView的 EnableViewState="false"

http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/69580996-2939-4ff4-8ee3-d3a0b1d25216/
http://weblogs.asp.net/alessandro/archive/2008/01/04/failed-to-load-viewstate-typical-problem-with-an-obvious-solution.aspx
回复  

使用道具 举报

2#
发表于 25-12-2008 22:08:11 | 只看该作者
Lifecycle of a Web Form
ViewState and its role in ASP.NET page processing
Stage 0 - Instantiation
Stage 1 - Initialization
Stage 2 - Load View State
Stage 3 - Load Postback Data
Stage 4 - Load
Stage 5 - Raise Postback Event
Stage 6 - Save View State
Stage 7 - Render
回复  

使用道具 举报

您需要登录后才可以回帖 登录 | FreeOZ用户注册

本版积分规则

小黑屋|手机版|Archiver|FreeOZ论坛

GMT+11, 2-11-2024 14:28 , Processed in 0.027638 second(s), 18 queries , Gzip On, Redis On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表