The requested page is not available for the requested platform. You are viewing the content for Default platform.

Toggle ViewState (all controls) (ASP.NET)

Adds the EnableViewState attribute with the True value to each control contained in the current container tag, or inverts the values of the existed EnableViewState attributes.


Available from the context menu or via shortcuts:

  • when the cursor is anywhere within an opening tag of a container that contains controls.


<div id="div1" class="divClass">
    <asp:Button EnableViewState="True" ID="Button1" runat="server" Text="Button" />
    <asp:Label ID="Label1" runat="server" Text="Label">MyLabel</asp:Label>
    <asp:TextBox ID="TextBox1" runat="server">My text</asp:TextBox>


<div id="div1" class="divClass">
    <asp:Button EnableViewState="False" ID="Button1" runat="server" Text="Button" />
    <asp:Label EnableViewState="True" ID="Label1" runat="server" Text="Label">MyLabel</asp:Label>
    <asp:TextBox EnableViewState="True" ID="TextBox1" runat="server">My text</asp:TextBox>



See Also