Friday, October 7, 2011

Textbox EnableViewstate = false property


What are the effects of Textbox EnableViewstate = false property


EnableViewstate property for textbox,dropdownlist controls doesn't effect anything
even though EnableViewstate is false or true.
if this is the case why Enableviewstate property exists for those controls?
No, not exactly. ViewState save any programmatic changes of textbox. For instance, you set textbox value


this.TextBox1.Text = "somevalue"

in a button click event. After postback this value will be saved in Save ViewState event method. When other submit or postback happend. ASP.NET will check the ViewState to load "somevalue" to textbox text property again. which this value is set in pervious visit(click the button).
More information. please check the paragraph #The Role of View State of Understanding ViewState article: