Stylesheets for Content pages

2. March 2010

Did research on this, quickest way to implement a separate stylesheet for content page is to add an extra content placeholder in the head section of the master page. Then for each content page can set a link to the stylesheet. Note that the head section of the master page must be set to runat server. So master page has the following head section:

<head runat="server">
    <title>Master Page</title>
    <asp:ContentPlaceHolder runat="server" ID="cphHeadSection">
</asp:ContentPlaceHolder>   
</head>

Add the following to your content page:

<asp:Content ID="ContentHead" ContentPlaceHolderID="cphHeadSection" runat="server">
    <link href="ContentStyles.css" rel="Stylesheet" type="text/css" />    
</asp:Content>

ASP.NET , ,