Copied to clipboard

Flag this post as spam?

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


  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    Aug 03, 2012 @ 11:24
    Ravi Motha
    0

    How do i check if a node is in a list of children

     I have a a node ID from my @Model.Id and I have a list of nodes  from item.Children.Where("Visible")  what i want to do is do a check to see if my @Model.Id is in my list.

    I've tried to use @item.Descendents(@Model.ID)  as my if statement, but I'm not sure that was working?

     

    foreach (var item in parent.Children.Where("Visible"))   
    {
        if (item.Children.Where("Visible").Count() > 0  && @Model.Lvel > 2 && @item.Desce      ndents(@Model.Id))
        {
            //do stuff here
        }
    }

    It's gonna be something silly, so any help would be appreciated

    Ravi

     

     

Please Sign in or register to post replies

Write your reply to:

Draft