TextBox can retain the value entered in it even if the viewstate is disabled, as LoadPostBackData event magically loads the data into TextBox at the PagePostBack. Is there a specific reason TextBox has ViewState or the ViewState has been just inherited from WebControl class?
Share
ViewState includes much, much more than just the text.
To clarify: if you do
Textbox1.Visible = false;then the control will not render any html output. With ViewState enabled its full runtime state will still be passed on to the next postback, including the Text property, the Visible property and many of its other properties.In other words, with ViewState enabled a Web Control never loses any of its state, even when the control itself is not rendered in the html output.
With ViewState disabled, the Text property (and all others) will lose their value as soon as you set Visible to False; or even if you set set Visible to False for its surrounding/parent control.