Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Candice 14 posts 34 karma points
    Oct 01, 2010 @ 19:22
    Candice
    0

    Nested MasterPages

    Hi,

     When I put html markup in a master page that inherits from another masterpage, the stylesheet is not being picked up. For example, my top level masterpage is named MasterTemplate. The MasterTemplate references a stylesheet and that is currently working fine. I have another template that inherits from MasterTemplate and is coded like this (Content_ChildContent is the content placeholder in the MasterTemplate):

    <%@ Master Language="C#" MasterPageFile="~/masterpages/MasterTemplate.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderId="Content_ChildContent" runat="server">
      <!-- start content box -->
                <div class="contentbox" align="left">
                <span class="contentheader">Header for Box</span>
                  <div class="contentcontent">
                    <umbraco:Item field="mainContent1" runat="server"></umbraco:Item>
                  </div>
                </div>
                <!-- end content box -->
    </asp:Content>

     

    I can see the text that I inject in the mainContent1 field, but it has no styling applied to it. what I'm trying to do is draw a box around the content area. I don't want the box drawn in the MasterTemplate because when I had it there, it was showing up even on pages that don't require it.

    thanks.

    Candice

     

     

  • Rich Green 2246 posts 4008 karma points
    Oct 01, 2010 @ 19:56
    Rich Green
    0

    Do you have a "/" before your stylesheet reference?

    As in

    <link type="text/css" rel="stylesheet" href="/css/all.css"/>

    Rich

  • Candice 14 posts 34 karma points
    Oct 01, 2010 @ 20:08
    Candice
    0

    Hi Rich,

     My stylesheet reference looks like this:

    <link href="~/css/Styles.css" rel="stylesheet" type="text/css" />.   I just tried taking the ~ out, and that made it so none of the pages find the stylesheet.

  • Candice 14 posts 34 karma points
    Oct 02, 2010 @ 02:26
    Candice
    0

    It is working now...and I don't even know what I did. I just started poking around, tweaking here and there and then all of a sudden it worked. My stylesheet is still referenced as above with the ~. My child masterpages are inheriting the markup from the master, but also able to inject their own markup and content, and the stylesheet is now being applied. Perhaps I didn't refresh my page enough and maybe I should have tried republishing the entire site... So now to move forward!

Please Sign in or register to post replies

Write your reply to:

Draft