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 289 posts 499 karma points MVP 4x 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

     

     

  • 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