asp.net RenderControl「建议收藏」

asp.net RenderControl「建议收藏」//usingSystem.IO;//usingSystem.Web;//usingSystem.Web.UI;//usingSystem.Web.UI.HtmlControls;protectedvoidPage_Load(objectsender
//using System.IO;
//using System.Web;
//using System.Web.UI;
//using System.Web.UI.HtmlControls;
protected void Page_Load(object sender, EventArgs e)
{
    HtmlGenericControl test = new HtmlGenericControl("div");
    test.Controls.Add(new HtmlButton());
    HtmlAnchor anchor = new HtmlAnchor();
    anchor.HRef = "#";
    anchor.InnerText = "test";
    test.Controls.Add(anchor);

    StringWriter writer = new StringWriter();
    HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);
    test.RenderControl(htmlWriter);
    Response.Write(writer.GetStringBuilder().ToString());
}
只听到从架构师办公室传来架构君的声音:
已忍伶俜十年事,强移栖息一枝安。有谁来对上联或下联?
本文来源qiume,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/209213
0

发表评论