你是怎么添加的?
可以使用placeHolder添加服务器控件.

解决方案 »

  1.   

    给个示例,比方说添加一个System.Web.UI.Button
      

  2.   

    Button button = new Button();
    button.ID = "Button1";
    Page.Controls[1].Control.Add(button);
      

  3.   

    TextBox TextBox1 = new TextBox();
    TextBox1.ID = "TB1";
    this.Page.Controls.Add(TextBox1);
      

  4.   

    Controls[1].Control.Add(xx);
    xx为任意可在Page内实现的控件
      

  5.   

    这样写出现如下错误:
    类型“TextBox”的控件“TB1”必须放在具有 runat=server 的窗体标记内。 
    怎么解决?
      

  6.   

    你的那个webform 一定要是 runat=server的
    并且控件要放在 webform内! Control tmp  = LoadControl("WebUserControl1.ascx");
    PlaceHolder1.Controls.Add(tmp);
      

  7.   

    http://expert.csdn.net/Expert/topic/1499/1499414.xml?temp=.4106104