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

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 1884
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">

<div>

<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" />

</div>

</asp:Panel>

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

<div>

<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" />

</div>

</asp:Panel>

</form>

Comments or Responses

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

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