Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset button doesn't clear text boxes

Status
Not open for further replies.

dpdoug

Programmer
Nov 27, 2002
455
US
I have an HTML Reset button on a web form that works fine for clearing all the text boxes on the form. But for some strange reason after adding or deleting a record with that form, it will no longer clear the boxes, unless you close the browser and open the page again.

Is this a bug?

If there were a substitute for the reset button in the server controls, I would use it. But as far as I can see there isn't one.

Does anyone know what causes this?
 
There is an HtmlInputButton control in the HTML controls acts as a reset button (click the HTML tab). You may or may not be using it, but I thought I'd give mention.

Anyhow, I guess the reset button doesn't necessarily blank the form values out, rather it restores them to their original state. From the MSDN docs:

Note A reset button does not support the ServerClick event. When a reset button is clicked, all input controls on the page are not necessarily cleared. Instead, they are returned to their original state when the page was loaded. For example, if a text box originally contained the value "JohnDoe", clicking on the reset button would return the text box to this value.

I bet your problem has to due with ViewState setting the control values when your page is loaded. Can you afford to turn ViewState off for the TextBoxes?

 
I disabled the viewstate on the text boxes and it didn't make any difference. But I'll try using the HtmlInputButton as you suggested and see how this works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top