What does the "EnableViewState" property do? Why would I want it on or off? [Resolved]

Posted by Shweta_Pinky under ASP.NET on 6/30/2013 | Points: 10 | Views : 949 | Status : [Member] | Replies : 2
What does the "EnableViewState" property do? Why would I want it on or off?




Responses

Posted by: Satyapriyanayak on: 6/30/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Enable ViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not. For example, if you are binding a control to data on every round trip, then you do not need the control to maintain it's view state, since you will wipe out any re-populated data in any case. ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false.

If this post helps you mark it as answer
Thanks

Shweta_Pinky, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: aswinialuri-19361 on: 6/30/2013 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi shweta,
view state property is true by default in such cases if you want to see where is view state saved and how view state values is retained between postback inthat cases it will be used enableviewstateproperty="true/false" .

Mark as Answer if it helps you
Thanks&Regards
Aswini Aluri

Shweta_Pinky, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response