在使用了母版页的页面里加载css和js文件

在子页面的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);

你可能感兴趣的:(css)