Copied to clipboard

Flag this post as spam?

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


  • Craig Cronin 304 posts 503 karma points
    Sep 07, 2011 @ 13:07
    Craig Cronin
    0

    List of Parents (HELP)

    I am trying to do a breadcrumb, but due to the implementation in need to do this in a usercontrol. I need a list of parents nodes from my current node.

    I know I can do the breadcrumb in RAZOR or XSLT.

     

    I need a GetAncestorOrSelfNodes property to bring back a list.

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Sep 07, 2011 @ 13:22
    Hendy Racher
    0

    Hi Craig,

    If you have uComponents installed, how about a uQuery call like:

    this.breadcrumbsRepeater.DataSource = 
    uQuery.GetCurrentNode().GetAncestorOrSelfNodes().Reverse();

    HTH,

    Hendy

  • Craig Cronin 304 posts 503 karma points
    Sep 07, 2011 @ 13:40
    Craig Cronin
    0

    Hi Hendy,

    Thanks for the reply.  I have seen some examples of the uComponents but didnt want to resort to this if there was a standard API way of doing things.  I'd seen this bit of code.

    umbraco.presentation.nodeFactory.Node curNode = umbraco.presentation.nodeFactory.Node.GetCurrent();
    umbraco.presentation.nodeFactory.Node target = curNode.GetAncestorOrSelfNodes().Where(n => n.GetProperty<string>("activeMenu") == "Main" || n.Id == 1672).FirstOrDefault();

    And it looked like there was a GetAncestorOrSelfNodes on the Umbraco Node which seems to have disappeared?.  Normally I would just do this using Razor, but I'm building a bilingual website that has two sets of placeholders on every document, so I need it a little more dynamic.

  • Craig Cronin 304 posts 503 karma points
    Sep 07, 2011 @ 13:48
    Craig Cronin
    0

    Hi Hendy,

    I've just tried your suggestion but I don't get the method

    GetAncestorOrSelfNodes

    I have referenced uComponents.Core.dll
  • Craig Cronin 304 posts 503 karma points
    Sep 07, 2011 @ 13:53
    Craig Cronin
    1

    Just fixed it, i need a reference to

    using uComponents.Core.uQueryExtensions;

     

    Thanks Hendy.

Please Sign in or register to post replies

Write your reply to:

Draft