Copied to clipboard

Flag this post as spam?

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


  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Mar 09, 2011 @ 17:21
    Tim Geyssens
    0

    Best way of getting ancestor of specific level

    What's the best way of getting an ancestor of a specific level (say for a second level nav, listing all children of the second level parent) ?

    Anyone got an idea?

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Mar 09, 2011 @ 17:43
    Sebastiaan Janssen
    1

    Something like this should work:

    @Model.Ancestors().Where("Level == 2")
  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Mar 09, 2011 @ 18:25
    Tim Geyssens
    0

    Yeah thought so but can't make it work getting an error

    Value cannot be null. Parameter name: expression

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Mar 09, 2011 @ 18:32
    Sebastiaan Janssen
    0

    weird, that works fine for me. Does @Model.Level work though? You could have a look after setting a breakpoint, maybe the stacktrace is a little more informative.

  • Niels Hartvig 1951 posts 2391 karma points admin hq c-trib
    Mar 09, 2011 @ 19:37
    Niels Hartvig
    1

    Both Ancestor(s) and Descendant(s) have level/nodetype filters now so this would work:

    - @Model.AncestorOrSelf(2) (get the ancestor (or model self) at the level of 2) 

    - @Model.AncestorOrSelf("umbHomepage") is also kind of cool (translates into get the ancestor (or model self) which has the nodetype alias of 'umbHomepage')

  • Gareth Evans 138 posts 329 karma points c-trib
    Mar 13, 2011 @ 03:45
    Gareth Evans
    0

    4.7RC didn't handle property lookups (not document properties but actual getters defined on the DynamicNode) properly

    Fixed in 4.7

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies