ASP.NET View State

The ViewState indicates the status of the page when submitted to the server. The retention of state is called the view state and is stored within a hidden control on the page. When an ASP.NET page is submitted to the server, the state of the controls is encoded and sent to the server at every form submission in a hidden field known as __VIEWSTATE. The server sends back the variable so that when the page is re-rendered, the controls render at their last state, so no extra programming is needed. If you try to view source code from browser you can see that ASP .NET has added a hidden field in the form to maintain the ViewState

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTkwNjc4NTIwMWRkL5PbikezkXhkI2kmrh3VUjVDGoU=" />
Maintaining the ViewState is the default setting for ASP.NET Web Forms. By default, most ASP.NET controls enable view state. If you want to not maintain the ViewState, include the directive <%@ Page EnableViewState="false" %> at the top of an .aspx page or add the attribute EnableViewState="false" to any control. You can also maintain ViewState for all pages in a web.config file .
<configuration> <system.web> <pages buffer="true" enableSessionState="true" enableViewState="true" autoEventWireup="true" /> </system.web> </configuration>

View state is a great idea to store information in a page, but if you wish to save more complex data, and keep them from page to page, you should look into using cookies or sessions is better.