Default Button in ASP.Net 2.0 - Community Credit Forums
in

    Community Credit Forums

Default Button in ASP.Net 2.0

Last post Wed, Jan 2 2008 11:42 AM by ChandanaAthauda. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • Wed, Dec 19 2007 12:04 AM

    Default Button in ASP.Net 2.0

    Hi guys,


    ASP.Net 2.0 has a property called default button in <form> tag and in Panel control. This enables the user to submit the form when the user hits enter.

    <form id="form1" runat="server" defaultbutton="btnSave">

    and

    <asp:Panel ID="Panel1" DefaultButton="btnSave" runat="server"></asp:Panel>

    Setting this attribute in form tag makes the default button global for that page and setting the default button attribute in Panel controls submits page when the user hits enter key inside the panel control.

    Regards,
    Satheesh
    http://satheeshbabu.blogspot.com
    www.satheeshbabu.com

  • Wed, Dec 19 2007 5:26 AM In reply to

    Re: Default Button in ASP.Net 2.0

    Thanks for the Post, Satheesh.  The DefaultButton can be a huge timesaver and is something new, but now widely known in 2.0.  I remember fighting with an app for hours trying to get the simulate this behavior in a 1.1 application.  I was definitely in Javascript hell.  It was a form that had a few buttons and one of them had to be clicked when the user hit enter.  It was such a huge pain to code the solution, so IMHO this is a really nice new feature.  Sometimes the little things mean alot. 

    Kindest regards,
      David Silverlight

    Follow me on Twitter: @HeadGeek
  • Wed, Jan 2 2008 10:38 AM In reply to

    Re: Default Button in ASP.Net 2.0

    David,

    The properties defaultButton and defaultFocus are pretty helpful. They solve a simple yet a very common task.

    Take a look @ http://dotnetslackers.com/community/forums/t/1190.aspx

    Regards,

    Deepak. 

    Filed under:
  • Wed, Jan 2 2008 11:42 AM In reply to

    Re: Default Button in ASP.Net 2.0

    Default Button in ASP.Net 2.0 is an awesome feature. But we should be careful when using this feature in ASP.NET master pages and panels.  Because, it may be lead to clash the default button in some browsers.

    My Logo
Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems