Hit Enter Key in a TextBox to Submit a Form – ASP.NET

In ASP.NET, by default, hitting the Enter key in a TextBox fires the Click event of the first button found in the form.
For example, you have sub-forms within a <form> element and each form requires its own default button.
The default action of firing the first button found on a Web page is not what we want.
Making the <form> run at server and setting a DefaultButton property for the form is not a solution since it can only assign one button as the default button.
Having more than one server-side forms is not a solution either since it will not work.

One solution is to surround each sub-form with <asp:Panel> element and setting its DefaultButton property to a desired button.
This way, you can have many sub-forms on one page with their own default buttons :)