Hit Enter key to Submit a Form or fire a Default Button Click Event in Asp.Net
It will be better and user friendly if we can submit the input form when the user is pressing the enter button after typing his input. This will provide a better experience to the users in huge input forms where one can submit the form without clicking the submit button explicitly.
From ASP.Net 2.0, <form> tag and Panel control has a property called defaultbutton. This enables the user to submit the form when the user hits enter key from the form.
<form id="form1" runat="server" defaultbutton="btnSave">
The above code will fire the btnSave click event on hitting enter key. And,
<asp:Panel ID="Panel1" DefaultButton="btnSave" runat="server"></asp:Panel>
Now, hitting enter key from inside the panel(Panel1) control will fire the click event of the button(btnSave).