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

Posted by Vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 1136
If More than one submit button inside the Asp.Net Panel,then we will write as:-
<form id="frm" runat="server">

<asp:Panel ID="Panel1" runat="server" DefaultButton="btnPanel1">


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

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

<asp:Button ID="btnPanel1" runat="server" Text="Submit" OnClick="btnPanel1_Click" />



<asp:Panel ID="Panel2" runat="server" DefaultButton="btnPanel2">


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

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

<asp:Button ID="btnPanel2" runat="server" Text="Submit" OnClick="btnPanel2_Click" />




Comments or Responses

Posted by: Ritujain on: 8/13/2015 Level:Starter | Status: [Member] | Points: 10

If we call same method onClick event than with both button there should be same functionality like

<asp:Button ID="btnPanel1" runat="server" Text="Submit" OnClick="btnPanel1_Click" />
<asp:Button ID="btnPanel2" runat="server" Text="Submit" OnClick="btnPanel1_Click" />

Other you can use Panel.DefaultButton property.

Login to post response