当前位置: 编程技术>.net/c#/asp.net
c# 动态添加非标准html控件的代码
来源: 互联网 发布时间:2014-08-30
本文导语: 方法1: 代码示例: HtmlGenericControl Include2 = new HtmlGenericControl("script"); Include2.Attributes.Add("type", "text/javascript"); Include2.InnerHtml = "alert('JavaScript in Page Header');"; this.Page.Header.Controls.Add(Include2); 也可以试试下面的方法: 代码示...
方法1:
代码示例:
HtmlGenericControl Include2 = new HtmlGenericControl("script");
Include2.Attributes.Add("type", "text/javascript");
Include2.InnerHtml = "alert('JavaScript in Page Header');";
this.Page.Header.Controls.Add(Include2);
Include2.Attributes.Add("type", "text/javascript");
Include2.InnerHtml = "alert('JavaScript in Page Header');";
this.Page.Header.Controls.Add(Include2);
也可以试试下面的方法:
代码示例:
Literal li = new Literal();
li.Text = "
li.Text = "