There are three ways to disable ViewState for a control, a page, and the entire application.
- control disabled: set the EnableViewState property of the control to false;
- page disabled: add EnableViewState=“false” in the Page instruction of the page;
- application disabled: add program code to the Web.Config file
<configuration>
<system.web>
<pages enableViewState="false"/>
</system.web>
< /configuration>
You can also disable EnableViewState=“false” in the page directive on the page Sometimes we found that ViewState could not transfer the value normally, maybe it was disabled, it is ok to enable it again!