在使用了主版頁面的頁面裡載入css和js檔案

來源:互聯網
上載者:User

在子頁面的Page_Load中寫
方法一:

 

       HtmlLink csslink = new HtmlLink();
       csslink.Attributes.Add("rel", "stylesheet");
       csslink.Attributes.Add("media", "screen");
       csslink.Attributes.Add("href", "style/style.css");
       csslink.Attributes.Add("type", "text/css");
       Page.Header.Controls.Add(csslink);

方法二:

       LiteralControl lc = new LiteralControl("<script type=\"text/javascript\" src=\"scripts/js1.js\"></script>");
       Page.Header.Controls.Add(lc);
相關文章

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.