I dynamically load a UserControl into a View that's in a MultiView control. Although the UserControl adds an event handler, the event never fires.
What am I missing here? Thanks!
Containing ASPX page:
protected override void OnPreRender(EventArgs e)
{
if (MultiView1.ActiveViewIndex == 2) //If the tab is selected, load control
{
Control Presenter = LoadControl("Presenter.ascx");
(MultiView1.ActiveViewIndex.Views[2].Controls.Add(Presenter);
}
base.OnPreRender(e);
}
Presenter.ascx.cs
override protected void OnInit(EventArgs e)
{
Retry.Click += this.Retry_Click; //This is a .Net 2.0 project
base.OnInit(e);
}
protected void Retry_Click(object sender, EventArgs e)
{
//This never fires
}