B
brett
I load a dynamic control once a button is clicked. In the control is
another button. However, I can't get its click event to fire. Here's
the pattern:
Page1.aspx
---------
SomeButton_Click()
{
Control control = LoadControl("mycontrol.ascx");
control.ID = "thecontrolID";
panel1.Controls.Add(control);
}
mycontrol.ascx
----------------------
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
this.mybutton.Click += new
mybuttonClickEventHandler(btnmybutton_Click);
}
Once SomeButton is clicked, the user control loads via AJAX and
appears. I see btnmybutton from the user control. Once I click it,
the click event doesn't fire. Any ideas?
Thanks.
another button. However, I can't get its click event to fire. Here's
the pattern:
Page1.aspx
---------
SomeButton_Click()
{
Control control = LoadControl("mycontrol.ascx");
control.ID = "thecontrolID";
panel1.Controls.Add(control);
}
mycontrol.ascx
----------------------
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
this.mybutton.Click += new
mybuttonClickEventHandler(btnmybutton_Click);
}
Once SomeButton is clicked, the user control loads via AJAX and
appears. I see btnmybutton from the user control. Once I click it,
the click event doesn't fire. Any ideas?
Thanks.