什么时候可以安全地禁用viewstate?

编程入门 行业动态 更新时间:2024-10-28 00:21:10
本文介绍了什么时候可以安全地禁用viewstate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

何时可以安全地禁用viewstate?对于哪些控件?在什么情况下?

When is safe to disable viewstate? For which controls? Under what circumstances?

在用户控件中,我已禁用viewstate,但是如果我尝试单击此控件,则

In a user control I have disabled viewstate, but if I attempt to click in this control

<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" OnClientClick="return confirm('¿Está seguro que desea eliminar el mensaje?');" EnableViewState="true"> <asp:Image ID="ImageButton1" runat="server" ImageUrl="~/Content/Images/delete.png" ToolTip="Eliminar mensaje" /> Eliminar </asp:LinkButton>

我收到一个System.InvalidOperationException异常.它在ListView内部.

I get an System.InvalidOperationException exception. It is inside a ListView.

推荐答案

在禁用viewstate的情况下,大多数控件的行为都与您期望的一样.带有Gridviews等内置功能的更具动态性"的控件在没有viewstate的情况下往往无法正常播放.

Most controls behave as you would expect with viewstate disabled. The more 'dynamic' controls with built in functionality like Gridviews tend not to play well without viewstate.

如果您已将控件上的enableviewstate属性设置为true,那么您是否确定异常与viewstate相关?

Are you sure that the exception is related to the viewstate given that you have the enableviewstate property set to true on your control?

更多推荐

什么时候可以安全地禁用viewstate?

本文发布于:2023-07-30 04:39:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1246285.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:什么时候   viewstate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!