With asp.net you can have "server side validators" , a feature
not present in "old" asp (or jsp, or php, or ..).
When a validator blocks a page, the user gets his/her page
back, complete with all (ok, nearly all: password is an exception)
values and the now-visible validator text.
If the input gets cleared after every postback, your user would need to
retype that input every time the validator blocks submission.
You, as the developer, can decide when the data is safe in the database
and only then clear the form. You could do this by clearing every named
input, or by writing a procedure that loops through all controls on the
page, clearing them in an appropriate manner.
Hans Kesting
"JollyK" <Jo****@email.com> wrote in message news:OE****************@TK2MSFTNGP11.phx.gbl...
Yes, the browser always sends the field values to the server. But after the
form is submitted, why does the asp.net textbox retain the text value. It
should be reset to the default value which is blank field. This issue only
with asp.net server controls. If i use <input type="text" name="txtname"
...... then I will not face this problem. I hope you are getting my
question.
"Patrice" <no****@nowhere.com> wrote in message
news:O4**************@TK2MSFTNGP11.phx.gbl... When you submit a form to a server, the browser always send the field
values (those who are named, not disabled and inside the form) to the server.
This is how a HTML form works "by design".
The "viewstate" is just an hidden field added by ASP.NET to store extra
informations and carry them over accross multiple server side executions
of the same page. It doesn't contains field values.
Patrice
"JollyK" <Jo****@email.com> a écrit dans le message de
news:eX**************@TK2MSFTNGP09.phx.gbl... Hello all,
I have always been having this issue and wondering what the solution is.
When I set the enableviewstate property to false for a textbox, the
textbox always retains its value after a postback occurs. Why is this? I want the textbox to become empty after postback. How can I do it without setting
textbox.text = "" and without doing Response.redirect to the same page.
JK