Feature Post

Top

Javascript: How to create ASP.NET Reset Button?

Wondering, how to create an ASP.NET based reset button; which is not an Html Reset(input type=reset)?

Type-in the following Javascript code into any ASP.NET control(Button, ImageButton, Link, etc) that exposes OnClientClick public property:

this.form.reset(); return false;

But why would I need this when there already is an Html based reset button available?

Sometimes you need this when you have a theme/skin applied over the page(that is, controls/buttons/textboxes/etc), and you want a button to be consistent with the site theme.

Note that you can append just about any Javascript code/function to objects and controls which then call straight up that Javascript function.