今天在开发ASP.NET上的控件时遇到了一个郁闷的问题,页面上有一个View Switch的功能要实现,可以选择使用Chart或是Grid来查看数据,包含了Grid Only, Chart Only, Grid with Chart等几种布局。开始的时候发现由Grid at Bottom到Grid at Right切换的时候,Chart的View State始终是null,后来实现Grid only到Grid at Right时,出现了以下的错误。
Exception Details: System.Web.HttpException: 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.
Stack Trace:
出错信息倒也详细,一看就知道出错原因,可是没想到Web Controls上还有这样的要求。
问题已经解决,但暂时不贴上来了,希望能听听大家的意见。
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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Web.HttpException: 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.
Stack Trace:
|
出错信息倒也详细,一看就知道出错原因,可是没想到Web Controls上还有这样的要求。
问题已经解决,但暂时不贴上来了,希望能听听大家的意见。