动态加载CSS文件
来源:百度文库 编辑:神马文学网 时间:2024/06/28 10:29:41
方法一:
WebForm1
private void Button1_Click(object sender, System.EventArgs e)
{Page.RegisterStartupScript("css",@"");
}
方法二:--- 戏子的方法..嘻..抄来的...
WebForm1
private void Button2_Click(object sender, System.EventArgs e)
{
System.Web.UI.Control a = Page.FindControl("myplaceholder");
System.Web.UI.HtmlControls.HtmlGenericControl objLink = new HtmlGenericControl("LINK");
objLink.Attributes.Add("rel","stylesheet");
objLink.Attributes.Add("type","text/css");
objLink.Attributes.Add("href","StyleSheet1.css");
objLink=objLink;
a.Controls.Add(objLink);
}
[注] asp:placeholder 这是控件是主要是起"占位符的做用"
_xyz
方法二:--- 戏子的方法..嘻..抄来的...
[注] asp:placeholder 这是控件是主要是起"占位符的做用"
_xyz