source code bean

15 May, 2009

Clearing a form in ASP.NET

Posted by: Peter 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;");



1 Response to "Clearing a form in ASP.NET"

1 | D. Ross

August 6th, 2009 at 1:33 am

Avatar

Great!

Thanks.

Comment Form


  • Joe: It looks like IceCoffee Script may provide the 'await' keyword to JavaScript. http://maxtaco.github.com/coffee-script/
  • Florian: Dealing with events has two primary fashions: imperative (synchronous) code, and callback (asynchronous) code. Both are legitimate styles, for some
  • Joe: I think we haven't seen true PaaS offering yet in Azure. If you use a webrole you're still running on your own VM. This is still not true multi-tena

About

Welcome to source code bean! On this site I post stuff that I encounter in my job and spare time. The content is mostly related to .NET development, but my interest in techonology is very broad, so often you will find posts on totally different subjects!