ASP.NET Dynamic nested button Event

Feb 21 2014 3:16 AM

1. On Button1_Click event of a button, i am generating
 another button named "b1" + its event.

2.on clicking the Button1, it is generating the new button
successfully but  event of new button is not firing.
please help me

=========CODE============

 Button b1;

  protected void Button1_Click(object sender, EventArgs e)
  {
  b1 = new Button();
  b1.Text = "ClickMe";
  b1.Click += new EventHandler(b1Click);
  form1.Controls.Add(b1);


  }
  protected void b1Click(object sender, EventArgs e)
  {
  b1.Text ="Event Fired";
  }

Answers (3)