Correct Click Event on Typing Enter

If you work with ASP.Net and have multiple buttons on the form that correspond to different textboxes you’ve probably run into the problem of a user pressing the “Enter” key and submitting to the wrong button’s server “Click” event.

I finally found the solution @ using Panel and DefaultButton.

You can put TextBox and Button inside the Panel and use DefaultButton property. In that case you will not need any javascript:

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