Navigation

Search

Categories

On this page

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 112
This Year: 50
This Month: 0
This Week: 0
Comments: 0

Sign In

 Tuesday, July 03, 2007
Tuesday, July 03, 2007 8:07:15 AM (Eastern Standard Time, UTC-05:00) ( )

Clearing a form of all entries or values is a common task in HTML but seemed to be a bit more challenging in ASP.NET.  It seemed the only way to do this was by posting the page back to itself using server.transfer("page.aspx")

I just stumbled across this method new to ASP.NET 2.0 using OnClientClick and it works great.

<asp:Button ID="btnReset" CssClass="smalltext" OnClientClick="Form1.reset();return false;" runat="server" Text="Clear Form" />

HTML version:

<input type="reset" value="Clear Form" name="Reset" onclick="ResetControls(this.form)">

Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):