What is viewstate in asp.net - Part 3

Category > ASP.NET || Published on : Saturday, April 25, 2015 || Views: 3265 || ASP.NET ViewState What is ViewState What is ViewState Video Tutorial What is ViewState Importanve


 

The ViewState allows ASP.NET to repopulate form fields on each postback to the server, making sure that a form is not automatically cleared when the user hits the submit button. All this happens automatically, unless you turn it off, but you can actually use the ViewState for your own purposes as well. Please keep in mind though, that while cookies and sessions can be accessed from all your pages on your website, ViewState values are not carried between pages. Here is a simple example of using the ViewState to carry values between postbacks: