If you try to use Enter key in ASP.NET, according to your browser type, you can get really weird results. In my previous article Default Button in ASP.NET 1.1, I described two methods to make enter key default button for form inputs in ASP.NET 1.1.
Fortunately, ASP.NET 2.0 makes this easier by introducing a concept of "default button" that can be used with either a <form> or <asp:panel> control. What button will be "clicked" depends of where acutally cursor is and what button is choosen as a default button for form or a panel.
For example, with the below sample:
<form defaultbutton=“button1” runat=“server”>
<asp:button id=“button1” text=“btn1” runat=“server”/>
<asp:panel defaultbutton=“button2” runat=“server”>
<asp:textbox id=“textbox1” runat=“server”/>
<asp:button id=“button2” text="btn2" runat=“server”/>
If the enter key is selected the first time the page is loaded, "button1" will be the button that receives the post-back event. If the enter key is hit while the user has their cursor focus within the "textbox1" textbox (contained within the <asp:panel>), then "button2" will be the button that receives the post-back event.