Can anybody explain ViewState(in ASP.NET) as succintly as possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
ViewStateis the mechanism that allows state values to be preserved across page postbacks.The web is stateless. But in ASP.NET, the state of a page is maintained in the page itself automatically. This is done Using ViewState. In ViewState the values are base 64 encoded and saved in hidden controls.
When you view the page source (in your browser) of a page the uses ViewState, you may see this hidden ViewState input which will look something like this:
This single hidden field contains all the viewstate values for all the page controls.
Because ViewState is (by default) sent to the client browser and then returned to the server in the form of a hidden input control on your page, storing a significant amount of data in ViewState can increase your page size and can affect your page performance.
To disable ViewState for a control, you can set the
EnableViewStateproperty to false.