Posting a form data using Enter key in Asp.Net using Single submit Button

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 768
If we have few Textboxes and one Submit Button then add the Defaultbutton property in the form tag and assign the button id to Defaultbutton property as like below:-

<form id = "frm" runat = "server" defaultbutton = "btnSubmit">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
</div>
</form>

Comments or Responses

Login to post response