ASP.NET HOWTO: Enable Default Enter Button in ASP.NET 2.0
How to make the Enter key submit an ASP.NET 2.0 form: set the HtmlForm's DefaultButton property instead of writing custom JavaScript.
In certain forms, such as search forms, users enter a value into the search query box, then press the enter button. If you are develolping in ASP.NET, the page will refresh, but nothing will happen. The buttons click event wont fire… UNLESS, you explicity enable a default enter button on the form.
A problem that existed in ASP.NET 1.x was that you could not specify a default enter button unless you provided some custom code. In ASP.NET 2.0 you can do this very easily, unfortunately its not that widely used, much less known.
HOW TO:
The HtmlForm object has a property DefaultButton. This property gets or sets the control that that causes the post back when the ENTER key is pressed.
Example
Result
When the user presses the ENTER key, the form will be posted back and the processRequestButton_Click event will be fired.
Simple!



