Reset a page in ASP.NET without postback

Syed Ali Taqi picture Syed Ali Taqi · May 15, 2014 · Viewed 8.1k times · Source

I want to reset a form but I'm using a few "Required Field Validator" every time I click the reset button the error message shows requiring fields... What I tried:

ReuiqredFieldValidator.Enabled = false; 
TextBox.Text="";


Response.Redirect("Samepage.aspx");
Response.Redirect("Request.RawUrl");

<input type=reset>

Answer

Majid picture Majid · May 15, 2014

Try this:

<asp:Button 
runat="server" 
ID="reBt" 
Text="Reset" 
OnClientClick="this.form.reset();return false;" 
CausesValidation="false"
/>

from here