When is it safe to disable viewstate?

When is it safe to disable viewstate? For control? In what circles?

In a user control, I disabled viewstate, but if I try to click 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>

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

+5
source share
4 answers

Most controls behave as you would expect with a viewstate disabled. More “dynamic” controls with built-in features like Gridview tend to not play well without a viewstate.

, , , enableviewstate, true ?

+3

, , . ,

( ). , , . view1 view2. , , viewstate, . ? serveride- , .

Datalist DropDownList - OnSelectedIndex , ViewState.

Gridviews - , viewstate . , viewstate. , . Gridview , . 5 , , , , gridview .

+8

. , , . .

, viewstate, .

0

If you are using .net framework 2.0 or a later version of the framework, you can use a new function called control state, not view state. This is much faster in terms of performance compared to performance.

For more information see below sites ...

http://www.pluralsight.com/community/blogs/fritz/archive/2004/07/01/472.aspx

http://msdn.microsoft.com/en-us/magazine/cc163901.aspx

http://www.codeproject.com/KB/user-controls/TestControlStateEx.aspx

0
source

All Articles