asp.net动态添加link标记
代码
//添加:
Header.Controls.Add(GroupManager.GetStyleLink(g.Style));
public static HtmlLink GetStyleLink(int style)
{
HtmlLink link = new HtmlLink();
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");
link.Attributes.Add("media", "all");
link.Href = "http://www***.com/css/group.css";
return link;
}
//修改:
<span id="spExam" runat="server"></span>
spExam.Attributes["Style"]="display:none";
Header.Controls.Add(GroupManager.GetStyleLink(g.Style));
public static HtmlLink GetStyleLink(int style)
{
HtmlLink link = new HtmlLink();
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");
link.Attributes.Add("media", "all");
link.Href = "http://www***.com/css/group.css";
return link;
}
//修改:
<span id="spExam" runat="server"></span>
spExam.Attributes["Style"]="display:none";