我动态地将UserControl加载到MultiView控件中的View中.虽然UserControl添加了一个事件处理程序,但事件永远不会触发.
我在这里错过了什么?
谢谢!
包含ASPX页面:
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 }