Skip to main content

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.

#Availability

Available from the context menu or via shortcuts:

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

#Examples

<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>

Result:

<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>
</div>

#Screenshot

rsToggleViewStateAllControls

See Also