Copied to clipboard

Flag this post as spam?

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


  • Simon 4 posts 24 karma points
    Jun 11, 2012 @ 12:58
    Simon
    0

    Inheriting/Accessing parent field value

    Hi everyone,

    I have a website laid out like below

     

    Home
    |_Section
     |_Subsection
     |_Subsection
    |_Section
     |_Subsection
      |_Sub-subsection
     |_Subsection

     

     

    and so on.

    At the "Section" level is a custom property called cssBackgroundColor and I need to be able to access from all child pages to set a css class on the body element.

    Is there an easy way to have child pages inherit the field value from their parent for easy access through

    <umbraco:item field="bodyText" runat="server" />

    Or is there an easy way to recursivly search for a parents field value?

     

  • Grant Thomas 291 posts 324 karma points
    Jun 11, 2012 @ 14:03
    Grant Thomas
    0

    You should be able to get away with this (using a recursive search):

    <umbraco:item field="bodyText" recursive="true" runat="server" />
  • Simon 4 posts 24 karma points
    Jun 11, 2012 @ 14:16
    Simon
    0

    Thanks Grant that does exactly what I needed it to do.

    Unfortunatly that usefull little attribute appears to be missing form the wiki documentation

    http://our.umbraco.org/wiki/reference/templates/umbracoitem-element/additional-attributes

Please Sign in or register to post replies

Write your reply to:

Draft