c# - instead of clicking 3 buttons, need to click only one button to call click method of remaining buttons -


i have 3 buttons different logic in web page in asp.net, instead of clicking 3 buttons need click 1 button call click method of remaining buttons. how should write code in code behind .cs

lets create 3 buttons same onclick handler.

default.aspx:

    <asp:button id="button1" runat="server" onclick="button1_click" text="button1" />     <asp:button id="button2" runat="server" onclick="button1_click" text="button2" />     <asp:button id="button3" runat="server" onclick="button1_click" text="button3" /> 

default.aspx.cs:

protected void button1_click(object sender, eventargs e) {     if (sender==button1)     {         //button 1 logic goes here     }     else if (sender == button2)     {         //button 2 logic goes here     }     else     {         //button 3 logic goes here     } } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -