当然不行。据个简单的例子:TableCell tableCell = 你的控件.Cells[0];
private Button button = new Button();
button .ID="它的ID"
tableCell.Contorl.add(button)
这样才能作为服务器端的控件用,多参考一下资料,以前有个分页的DataGrid是个很好的例子

解决方案 »

  1.   

    用容器
     然后 
     容器.Controls.Add(button)
      

  2.   

    tryusing System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.ComponentModel;namespace WebControlLibrary1
    { public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
    {
    private Button button = new Button(); protected override void CreateChildControls()
    {
    button.Text="MyButton";
    button.ID = "button";
    Controls.Add(button);
    } }
    }
    orusing System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.ComponentModel;namespace WebControlLibrary1
    { public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
    {
    private Button button = new Button(); protected override void Render(HtmlTextWriter output)
    {
                            //not easy to handle events
          button.Text="MyButton";
                            button.ID = "button";
          button.RenderControl(output);
    }
    }
    }