ViewState does not hold the controls, rather it holds the values of the form controls and their corresponding ID's that would otherwise be lost due to a post back because they do not post with the form. ViewState is not used to hold session data or to transmit data between pages.
Viewstate : "Let we go for Viewstate we understand why we used we Viewstate is a part of state managment in .net" There are two type of statemanagment (1)Server side StateMangment (2) Client Side StateMagment
1)Server Side StateMangment : Application object ,Session 2)Client Site StateMangment :Viewstate,Cookies,HiddenField,QueryString Viewstate :-" Viewstate is a state of the object to be stored in the hidden field on the Page.Viewstate is transported to the client and back to the server.It does not stored in the server side or other extrnal resource.Viewstate used to retain the server side object between page post back.It holds a value when a form is posted.Why we used : No Server Resource,Security purpose,Flexibility
Microsoft ASP.NET ViewState is the technique used by an ASP.NET Web page to persist changes to the state of a Web Form across postbacks.
In asp.net, viewstate is placed in a hidden form field named __VIEWSTATE
View State is nothing but maintaining the state of variables or controls using hidden variables kind of technology.This makes stateless webpage to state full webpages.
ViewState is the mechanism that allows state values to be preserved across page postbacks.Because of the stateless nature of web pages, regular page member variables will not maintain their values across postbacks. When we need a page variable to maintain its value across page post backs, we can use ViewState to store that value. Values stored in ViewState will be serialized and sent to the client browser as the value of a hidden form input.
Example:
<asp:Label ID="lblRequestCount" runat="server" EnableViewState="false"></asp:Label>
it is the technique of keeping and maintaining the form data between server request and response.
View State = Physically it is an object that stores Page's informations in a hidden control.