I create a Button from code c #, now I need to add a method when I click on the ... I did this but it does not work
public void AgregarBoton()
{
Button miBoton = new Button();
miBoton.ID = "BtnCheck";
miBoton.ForeColor = System.Drawing.Color.Silver;
miBoton.Font.Size = 9;
miBoton.BackColor = System.Drawing.Color.Indigo;
miBoton.Text = "CHECKOUT";
miBoton.Click += new System.EventHandler(MiBoton_Click);
miBoton.Width = 120;
miBoton.Height = 30;
PlaceHolder1.Controls.Add(miBoton);
}
public void MiBoton_Click(Object sender, System.EventArgs e)
{
Button bt = (Button)sender;
Session["p"] = "fsdfsdfsf";
Label2.Text = Session["p"].ToString();
}