Copied to clipboard

Flag this post as spam?

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


  • BarneyHall 141 posts 210 karma points
    Nov 30, 2011 @ 18:10
    BarneyHall
    0

    Children DoctypeName clause

    Hi, can anyone tell me how to include a clause when listing children within a foreach statement?

    For example, the following lists all Children nodes, but I want to list all Children except a particular DoctypeName, i.e. everything except Posts (for example).

    @foreach (var page in homeNode.Children.Where("Visible")) 

    Any ideas? Thanks as ever...
    Barney

     

     

     

     

  • Sebastiaan Janssen 5045 posts 15477 karma points MVP admin hq
    Nov 30, 2011 @ 18:12
    Sebastiaan Janssen
    0

    You're looking for the nodeTypeAlias in that case, try this:

    @foreach(var page in homeNode.Children.Where("Visible").Where("NodeTypeAlias != \"Post\"")) {}
  • BarneyHall 141 posts 210 karma points
    Dec 01, 2011 @ 09:41
    BarneyHall
    0

    Thanks Sebastiaan, works a treat

Please Sign in or register to post replies

Write your reply to:

Draft