何时可以安全地禁用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?
发布评论