Clearing a form in ASP.NET

You would think that ASP.NET would have build in support for something so simple as clearing all input fields on a page, but no. However, this easy to add. Add the following to your Page_Load (btnClear should be the name of your clear button):

btnClear.Attributes.Add("onClick", "document.forms[0].reset();return false;");


One thought on “Clearing a form in ASP.NET

Leave a Reply

Your email address will not be published. Required fields are marked *