this.PlaceHolder1.Controls.Add(new TextBox()); //可以
this.PlaceHolder1.Controls.Add(new MyContorl); // 不能显示用户控件MyContorl。
应改为:
MyContorl control = (MyContorl)Page.LoadControl("~/Ctrl/MyContorl.ascx");、
this.PlaceHolder1.Controls.Add(control);
MyContorl control = (MyContorl)Page.LoadControl("~/Ctrl/MyContorl.ascx");、
this.PlaceHolder1.Controls.Add(control);
转载于:https://www.cnblogs.com/Ken-Cai/archive/2009/09/29/1576126.html