母片頁的內容頁導入css方法

來源:互聯網
上載者:User

 

方法

 /// <summary>
    /// 在內容頁匯入css
    /// </summary>
    /// <param name="page">當前頁面</param>
    /// <param name="cssPath">css樣式路徑</param>
     public  static void AddStyleSheet(Page page, string cssPath)
    {
        HtmlLink link = new HtmlLink();
        link.Href = cssPath;
        link.Attributes["rel"] = "stylesheet";
        link.Attributes["type"] = "text/css";
        page.Header.Controls.Add(link);
    }    調用:
AddStyleSheet(this.Page, "樣式表路徑");

 

 

 

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.