yes. because http is stateless, view state is a hidden input field in the html form that contains base 64 encoded data it's essentially a big serialized blob of every "control" dumps it's variables into before being unloaded (sent to the client's browser), so that when the form is posted back, it can re-load the state of it's internal variables so that it appears at the code level to be stateful.
"in a nutshell, is the technique used by an ASP.NET Web page to persist changes to the state of a Web Form across postbacks. In my experiences as a trainer and consultant, view state has caused the most confusion among ASP.NET developers. When creating custom server controls or doing more advanced page techniques, not having a solid grasp of what view state is and how it works can come back to bite you. Web designers who are focused on creating low-bandwidth, streamlined pages oftentimes find themselves frustrated with view state, as well. The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE. This hidden form field can easily get very large, on the order of tens of kilobytes. Not only does the __VIEWSTATE form field cause slower downloads, but, whenever the user posts back the Web page, the contents of this hidden form field must be posted back in the HTTP request, thereby lengthening the request time, as well."
With regards to MadHatter and Mike_Davidson, I'd like to add few lines.
View state involves storing data on the client. This is the most basic thing you need to understand. Now this data, in some cases, become very very large(what MadHatter points out). Now as it is too large, and stored in hidden fields, some proxies and firewalls will prevent access to the page that contains them.
To solve this, ASP.NET 2.0 page framework introduces a feature called view-state chunking. If the data becomes very large, then it'll automatically split the data into chunks and put them into multiple hidden form fields.
To use view-state chunking go to Page_Load method and write
MaxPageStateFieldLength = 250;
3 answers
yes. because http is stateless, view state is a hidden input field in the html form that contains base 64 encoded data it's essentially a big serialized blob of every "control" dumps it's variables into before being unloaded (sent to the client's browser), so that when the form is posted back, it can re-load the state of it's internal variables so that it appears at the code level to be stateful.
answered 2 years ago by:
2309
510
don't get @madhatter started on viewstate and webforms! hehe
2309
:P am I that obvious?
I found this article that might be of help:
"in a nutshell, is the technique used by an ASP.NET Web page to persist changes to the state of a Web Form across postbacks. In my experiences as a trainer and consultant, view state has caused the most confusion among ASP.NET developers. When creating custom server controls or doing more advanced page techniques, not having a solid grasp of what view state is and how it works can come back to bite you. Web designers who are focused on creating low-bandwidth, streamlined pages oftentimes find themselves frustrated with view state, as well. The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE. This hidden form field can easily get very large, on the order of tens of kilobytes. Not only does the __VIEWSTATE form field cause slower downloads, but, whenever the user posts back the Web page, the contents of this hidden form field must be posted back in the HTTP request, thereby lengthening the request time, as well."
http://msdn.microsoft.com/en-us/library/ms972976.aspx
I would also suggest, after understand the viewstate, you get a strong handle on the ASP.NET page lifecycle.
answered 2 years ago by:
246
With regards to MadHatter and Mike_Davidson, I'd like to add few lines.
View state involves storing data on the client. This is the most basic thing you need to understand. Now this data, in some cases, become very very large(what MadHatter points out). Now as it is too large, and stored in hidden fields, some proxies and firewalls will prevent access to the page that contains them.
To solve this, ASP.NET 2.0 page framework introduces a feature called view-state chunking. If the data becomes very large, then it'll automatically split the data into chunks and put them into multiple hidden form fields.
To use view-state chunking go to Page_Load method and write
MaxPageStateFieldLength = 250;
answered 2 years ago by:
226