Copied to clipboard

Flag this post as spam?

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


  • AlexR 39 posts 61 karma points
    May 06, 2010 @ 10:28
    AlexR
    0

    How to show parent field in child template

    I am creating master page where I need to show parent's nodeName.

    Is it possible without using XSLT?

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    May 06, 2010 @ 11:03
    Hendy Racher
    0

    Hi Alex, you could use:

    <% =umbraco.presentation.nodeFactory.Node.GetCurrent().Parent.Name %>

    although if using this with the root node, then you'll have to change it to check that the Parent isn't null:

    HTH,

    Hendy

  • AlexR 39 posts 61 karma points
    May 06, 2010 @ 11:50
    AlexR
    0

    Thank you! It is work.

    But how could I call macro with parent id?

    <umbraco:Macro Alias="contentHeader" source="<% =umbraco.presentation.nodeFactory.Node.GetCurrent().Parent.Id %>" runat="server"></umbraco:Macro>

     

  • AlexR 39 posts 61 karma points
    May 06, 2010 @ 11:51
    AlexR
    0

    Does not work.

  • Chris Dunn 210 posts 401 karma points
    May 11, 2010 @ 22:21
    Chris Dunn
    1

    Alex,

    You can use inline xslt which would prevent you from needing to create a separate macro.  Or maybe you're opposed to xslt on principal :-)

    Anyway, you could call the page field like the following to display the parent name without using macro:

    <umbraco:Item runat="server" field="pageID" xslt="umbraco.library:GetXmlNodeById({0})/parent::node/@nodeName " />

    Hope that helps.

    -Chris

Please Sign in or register to post replies

Write your reply to:

Draft