It looks like you are using web forms.
You can wrap what you do inside the Panel and set the DefaultButton property inside the panel.
<asp:Panel ID="LoginPanel" runat="server" DefaultButton="btLogin"> <asp:TextBox ID="txtUser" runat="server" /> <asp:TextBox ID="txtPass" runat="server" /> <asp:Button ID="btLogin" runat="server">Login</asp:Button> </asp:Panel>
When the user entered the data in txtUser and txtPass , and then press the Enter key, they will launch the btLogin button.
David east
source share