Many controls of same type using one common event in codebehind
Posted on 2003-11-06
I would like to have multiple bottons on one ASPX form. As well, very similar activity would happen during the onclick event of the buttons. I am much too lazy to retype the same code for each of the onclick events. How can I use the same onlick event for all of my buttons and just pass a parameter to the onclick event?
So, for example, I will have the following in the codebehind:
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button3;
private void ButtonX_Click(object sender, System.EventArgs e)
//send additional parameter value A, B, or C, depending on the button
//call next function...
What code adjustments should I made?