What is "View State"?
Ibrahim Ersoy
Select an image from your device to upload
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
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>