How to disable view state from control. Sometimes you build element and make in server control by adding runat="server". This can cause the view state to be large. In this tutorial we will show you how to detect which control has large ViewState size and how to disable it. Remember that the view state is not always necessary, so if you not need it remove it.
The problem: 81K of View state!!
Step 1: Add the Trace attribute and set it to true.
<%@ Page Trace="true" %>
Step 2: Run the page and watch the trace search the ViewState Size and search for large size.
Step 3: Add enableviewstate attribute to your server control and set it to false.
<div id="Providers_Content_1" runat="server" enableviewstate="false">
Result: The view state is now 6K size.