a reset button

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
 
K

Kevin Spencer

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.
 
C

Cliff Harris

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top