Copied to clipboard

Flag this post as spam?

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


  • Jules 276 posts 587 karma points
    Jan 03, 2012 @ 03:34
    Jules
    0

    List subpages of parent from parent node or child node

    Hi all 

    I have a site structure 

    Home
        Artists
            Artist

    I have this snippet for getting subpages of Artists where Artists is the current node.But it doesnt work when on one of the Artist pages.

     

    <ul>
        @foreach (var item in @Model.Artist.Where("Visible"))
        {
        <li><a href="@item.Url">@item.Name</a></li>
    }
    </ul>

     

    What should I be doing so that I can list all Artists items when Current node is either Artists or Artist doctype.

    Cheers 

    J

  • Rodion Novoselov 694 posts 859 karma points
    Jan 03, 2012 @ 05:17
    Rodion Novoselov
    0

    Hi. I hope it will help:

    <ul>
        @foreach (var item in Model.AncestorOrSelf("artists").Children.Where("Visible"))
        {
       
    <li><ahref="@item.Url">@item.Name</a></li>
    }
    </ul>
  • Jules 276 posts 587 karma points
    Jan 03, 2012 @ 11:39
    Jules
    0

    Perfect

    Thanks Rodion

Please Sign in or register to post replies

Write your reply to:

Draft