By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,468 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

a reset button

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

"angus" <an***@angus.com> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
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

Nov 18 '05 #2

P: n/a
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

"Bin Song, MCP" <an*******@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
I agree. However, if you want to get the initial value, you need to reload the page. <script language="javascript" for="btnReset" event="onclick">
window.location.reload();
</script>

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.