你使用VS.net开发asp.net就不会出现这个问题注意AutoEventWireup="false"

解决方案 »

  1.   

    首先改正你的Page_load,改成如下
    private void Page_Load(object send, EventArgs e)
    {
        //userControlSample thePagelet = (userControlSample)Page.LoadControl("default.ascx");
        //thePagelet.TextBoxText = "This is a TextBox";
        //thePagelet.LabelText = "This is a Label";
        //htmlForm.Controls.Add(thePagelet);
        if (!Page.IsPostBack)
        {
            htmlForm.Controls.Add(new LiteralControl("<h3>Content</h3>"));
        }
    }
    然后把在html代码中的注释去掉,asp.net运行库非常灵敏,如果你加入asp.net的控件代码,加入注释也不行,asp.net运行库一样可以识别,把注释删除即可。