using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Caching;
/// <summary>
/// 用于动态加载CSS,解决母版页无法改变CSS的问题
/// </summary>
public class WebLoader
{
/// <summary>
/// 动态加载CSS,用于Page页面
/// </summary>
/// <param name="page">页面</param>
/// <param name="cssFileName">CSS文件名</param>
public static void LoadCSS(Page page,string cssFileName)
{
HtmlLink link=new HtmlLink();
link.Href = "~/CSS/" + cssFileName;
link.Attributes["rel"]="stylesheet";
link.Attributes["type"] = "text/css";
page.Header.Controls.Add(link);
}
}