Click here to Skip to main content
15,885,998 members
Articles / Web Development / ASP.NET
Alternative
Tip/Trick

How to make a button the default button on enter on an ASP.NET form

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
22 Jul 2011CPOL 21.4K   5   1
You can set the default button on your form tag as below code.ORyou can set the default button on a panel as below.And you can place your...
You can set the default button on your form tag as below code.
<form id="form1"  runat="server" defaultbutton="Button1">


OR

you can set the default button on a panel as below.

<asp:Panel ID="panel1" runat="server" DefaultButton="Button1"></asp:Panel>



And you can place your controls on either form or on the panel.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 5 Native solutions are always better t... Pin
Lisetsky Val25-Jul-11 19:11
Lisetsky Val25-Jul-11 19:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.