a reset button

  • Thread starter Thread starter angus
  • Start date Start date
A

angus

Dear All,

I have to implement a reset button in the web form.

i think that i can use the web component(button) to get the fired onclick
event on the reset button. after the postback, the related eventhandle will
set the textbox control to be empty.

but why not simple use the javascript to reset all the values / or use the
reset type button(HTML button)? it save a postback.

What do you think?

Regards,
angus
 
You could certainly do that. Just make sure that you don't have any
ViewState issues upon PostBack.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
That could be undirable, especially if the page takes any time at all to
load. You can do something very similar however that doesn't require
reloading the page:
Just use a standard HTML button (non-ASP) like the following:

<input type="button" value="Reset" onclick="document.formname.reset();">

Of course, "formname" is the id of the <form> tag.

If you want to use an image to do the same thing, you can do so:
<a href="javascript:document.formname.reset();"><img src="..."></a>

HTH,
-Cliff
 
Back
Top