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

Categories

Adwords

Twitter Updates


    • Petan: I got in bootstrap this (insted of $frontController->getRouter()): $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/routes.ini', 'rout
    • oanh tong ngoc: :) It's usefull but could U give everyone's an example with a project source code. Thanks
    • Peter: Hi Sohaib, It seems like the rewrite module isn't loaded by IIS. Have you uploaded the UrlRewriter dlls and made the changes to web.config on the ser

    About

    Welcome to source code bean! You will find information on tips and tricks on programming languages, server side stuff, and anything that causes troubles to web development.