i have created a dynamic button under listbox selectedindex change.
i have written the code for the click. the event is not raising. here is my code.
if (Controllist.SelectedValue == "Button")
{
if (Page.IsPostBack)
{
Button btn = new Button();
ContentPanel.Controls.Add(btn);
btn.ID = "dynbtn";
btn.Text = "Dynamic Button";
btn.Height = 30;
btn.Width = 70;
btn.Click += new EventHandler(btnclick);
}
}
protected void btnclick(object sender, System.EventArgs e)
{
TextBox txt = new TextBox();
ContentPanel.Controls.Add(txt);
txt.Height = 30;
txt.Width = 100;
txt.Text="This is Dynamic Text Box";
}