且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

css样式表从内容页

更新时间:2023-01-20 11:38:06

找到了!



但我相信你的答案也一样。

 < asp:Content ID =Content1 ContentPlaceHolderID =headrunat =server> 
< link href ='<%= ResolveClientUrl(〜/ Styles / StyleSheet1.css)%>'rel =stylesheettype =text / css/>
< / asp:Content>


iv'e got a content page with a link to a style sheet which i want to be specific for that page , i.e. i want the design to be specific for that page when it loads and takes its place in the contentplaceholder on the main page.

IN MY CONTENT PAGE :

  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
      <link href="~/Styles/StyleSheet1.css" rel="stylesheet" type="text/css" />
  </asp:Content>

IN MY MAIN PAGE :

   <asp:ContentPlaceHolder ID="head" runat="server">       
   </asp:ContentPlaceHolder>  

MY STYLE SHEET ~/Styles/StyleSheet1.css just for example ill give this id to some table in my content page.

       #defualt_tbl
       {
          background-color:Gray;
       }

       <table id="defualt_tbl">

the table does not become gray , when i click viewsource in the master page the link is present in the head section.

        <link href="~/Styles/StyleSheet1.css" rel="stylesheet" type="text/css" />

found it !

but i belive your answers work as well .

  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
     <link href='<%= ResolveClientUrl("~/Styles/StyleSheet1.css") %>' rel="stylesheet"    type="text/css" />
  </asp:Content>