How to make a button the default button on enter on an ASP.NET form





3.00/5 (3 votes)
By putting your intended content in a division as bellow, the button you set as default button will be hit when you hit enter button on any element which is in the division.
<div onkeypress="return WebForm_FireDefaultButton(event, '<%= btnSubmit.ClientID %>')">
<!-- put your form cntrols here -->
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</div>