开发者

Doubled Viewstate field ASP.NET

开发者 https://www.devze.com 2023-02-22 22:54 出处:网络
Please help guys, the issue is - i have main page and want to render another page inside it using Server.Execute(\'demo.aspx\')

Please help guys, the issue is - i have main page and want to render another page inside it using Server.Execute('demo.aspx')

All is fine except one thing - main page generates one Viewstate field and inner (called / extern) page creates new one and when i try to do POST submit it generates an error with ViewstateException.

The question is - how to prevent generating Viewstate for Server.Execute() i.e. inner page?

Thanks in advance, any h开发者_JAVA技巧elp appreciated.


It's actually doing exactly what it should. Server.Execute() basically will insert the second page's content into the first page, including ViewState.

To remedy your problem, are you able to disable ViewState on the page that's being called (demo.aspx)?

<%@ Page Language="C#" EnableViewState="false" CodeBehind="demo.aspx.cs"
0

精彩评论

暂无评论...
验证码 换一张
取 消