第一种:添加的是</br>
第二种:添加的为<br></br>
Label lbl = new Label();
lbl.Text = "测试下自定义控件";
this.Controls.Add(lbl);
BR br = new BR();
this.Controls.Add(br);
class BR : Control
{
protected override void Render(HtmlTextWriter writer)
{
writer.Write("<br />");
}
}
第二种:添加的为<br></br>
System.Web.UI.WebControls.Label lb = new System.Web.UI.WebControls.Label();
lb.ID = "Label" + i;
divs.Controls.Add(lb);
divs.Controls.Add(new System.Web.UI.HtmlControls.HtmlGenericControl("br"));