用户控件有设计方便,界面可视化等优点,但是通常我们创建之后都是直接拖到页面中使用的,能不能在页面加载时动态创建呢?答案是肯定的: 请看如下代码: protected void Page_Load(object sender, EventArgs e) ...{ if (!IsPostBack) ...{ this.Form.Controls.Add(LoadControl("~/Controls/CopyRight.ascx")); //就是这里 TextBox txt = new TextBox(); //这里是创建一个ASP.net控件。 this.Form.Controls.Add(txt); } }