Quote:
|
If i remember right.. the fact that the fields keep their value once submitted is the result of the viewstate engine.
|
Close, but not cigar ;-)
The state engine (without ViewState) does this for you. When you submit a form control (such as a text box) ASP.NET is able to prepopulate the control again based on the value in the submitted form. This works for controls that submit their data through a form, such as text boxes, select lists, radio buttons and so on.
For controls that cannot do this themselves (a Label, a GridView, etc) or custom code, View State is used which uses the hidden __VIEWSTATE field to send the data from and to the server.
So, even if you disable View State, a TextBox control still retains its value after a postback. To clear its value, simply set it to an empty string:
myTextBox.Text = String.Empty.
Hope this helps,
Imar