You need a submit button with default focus on it. For that, you need to add
"DefaultButton" property for the page.
In ASP.NET 2.0 onwards, it's said to have "Default Button" defined for the page. By simply specifying the
"defaultbutton"
property to the ID of the
<asp:Button>
, whose event you want to fire, your job is done.
The defaultbutton property can be specified at the Form level in the form tag as well as at panel level in the
<asp:panel>
definition tag. The form level setting is overridden when specified at the panel level, for those controls that are inside the panel
Sample example:
<form id="Form1"
defaultbutton="SubmitButton"
defaultfocus="TextBox1"
runat="server">
Refer:
ASP.NET DefaultButton Property[
^]
Sample usage of Default button[
^]
No need of any key code or so. Using above, default behavior of enter press would direct it as defined for that button click.