Copied to clipboard

Flag this post as spam?

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


  • C Andreasson 79 posts 207 karma points
    Feb 20, 2014 @ 13:06
    C Andreasson
    0

    Navigation with Razor

    Hi 

    I try to list the top(1) of my navigation - but somthing is not right?

    Please some ideas ?

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Feb 20, 2014 @ 13:09
    Jeavon Leopold
    100

    Hi there,

    Try:

    var root = CurrentPage.AncestorOrSelf(1);
    

    This will find the first node of level 1 up the tree which will be either "DK" or "EN" depending on the node being rendered.

    Jeavon

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 20, 2014 @ 13:09
    Fuji Kusaka
    0

    Try  this

    var root = Model.AncestorOrSelf(1).Descendants("docType").Items;
  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Feb 20, 2014 @ 13:11
    Jeavon Leopold
    1

    @Fuji, this is a MVC query not DynamicNode, check the first line PartialViewMacroPage :-)

  • Fuji Kusaka 2203 posts 4220 karma points
    Feb 20, 2014 @ 13:15
    Fuji Kusaka
    0
    Oh yes i didnt see that i only looked at var root =

     

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Feb 20, 2014 @ 13:22
    Jeavon Leopold
    0

    I tell you what, it would be great if every post had the @inherits line so it's easy to tell if it's MVC/IPublishedContent or DynamicNode :-)

  • C Andreasson 79 posts 207 karma points
    Feb 20, 2014 @ 14:12
    C Andreasson
    0

    Many thanks for the reply. I was almost there. ;-)

    By the way, when I've got an answer is there anything I need to do to finish the question?

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Feb 20, 2014 @ 14:17
    Jeavon Leopold
    0

    Great!

    Looks like you found the green tick already which is "mark this reply as the solution"

  • C Andreasson 79 posts 207 karma points
    Feb 20, 2014 @ 14:45
    C Andreasson
    0

    Yes thank you so much ;-)

     

Please Sign in or register to post replies

Write your reply to:

Draft