what is view state i need important points in asp.net
what is view state i need important points in asp.net
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SenthilkumarPosted Apr 4, 2012, 2:59 AM
The View State is client state mechanism in the ASP.Net statement management.
The view state is control it will be used to maintain the state of the control across the posted back to the server. The value will be stored in the hidden control. Every time it needs to encryption and decryption (serialize and deserialize across the post backs).
The view state can be enabled by setting the property called EnableViewState="true/false". It can be set in the machine config/ web config/ page directives/ control level.
By default it is false. You can enable it by setting boolean flag.
This can be used with in the page and not across the page.
Viewstate["Version"] = txtVersionName.Text.ToString();
The view state also can store the data using the key and value combination. The data will be serialized and stored in the hidden control You can view the source code page and find the hidden control with _viewstate.
The viewstate stores in the hidden control of the client side and the size is the most problem. It renders lot and it directly impact on the performance. In order to decrease the size of the view state you can compress it.
Please refer this url for view state compression:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=67
Drawbacks:
- Increase the page payload (when you have grid with many rows then every thing has to be loaded and retain again with serialize and deserilize)
- Additional overhead while serialize and deserialize.
- Increase the memory allocation on the server.
-It can be tempered by the hackers if they know the format.
Please go through this MSDN for more information:
http://msdn.microsoft.com/en-us/library/ms972976.aspx
MuthuMari MPosted Apr 4, 2012, 3:30 AM
http://24x7aspnet.blogspot.in/2009/05/viewstate-in-aspnet-20.html