First, if the <link> label is added outside the <asp: Content> label on the page where MasterPage is applied to reference the CSS file, a compilation error will occur. If the CSS file is referenced in the <asp: Content> label, an incorrect interpretation will occur. referencing a CSS file in the
In addition, compared with this method, there is a simple Hack. First, add the <link> tag to MasterPage, but the herf attribute is empty. <Head runat = "server">
<Link id = "cssStyleSheet1" rel = "stylesheet" type = "text/css" runat = "server"/>
<Link id = "cssStyleSheet2" rel = "stylesheet" type = "text/css" runat = "server"/>
<Link id = "cssStyleSheet3" rel = "stylesheet" type = "text/css" runat = "server"/>
</Head>
The number can only be cold ...... If you do not know how much it will be used, just put a few more. Then, the herf attribute of the <link> tag is dynamically modified on the page where MasterPage is applied. Protected void Page_Init (object sender, EventArgs e ){
If (! IsPostBack ){
HtmlLink csslink = (HtmlLink) Master. FindControl ("cssStyleSheet1 ");
Csslink. Attributes. Add ("href", "Cart.css ");
}
}
At present, I have discovered only these two methods. If you have any good solutions, please tell your younger brother that you are currently working on an application involving this problem.
PS. Is there a bug in garden? I suddenly found out that I got to the homepage ...... It seems to have been sent to another category. If you edit the default category, the homepage will be changed ...... -_-Bb