Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    May 14, 2013 @ 17:26
    Fuji Kusaka
    0

    ChildrendAsList DocType

    Hi Guys,

    How do i get to check the DocType of all the child nodes in folder with dynamicNode ? 

    List<DynamicNode> VFolder = @Model.AncestorOrSelf(1).Descendants("folder").Items;
    
    @foreach(var fd in VFolder){
    if(fd.ChildrenAsList.Where("NodeTypeAlias == \"test\"").Count() > 0){   // Here Where triggers me an error
                   @fd.Name
    }


    The reason for this is i have multiple folders but with different child node of differentDocType

    Any susggestions please

     

  • Fuji Kusaka 2203 posts 4220 karma points
    May 14, 2013 @ 17:46
    Fuji Kusaka
    0

    Got it working 

    if(fd.ChildrenAsList.Where(x => x.NodeTypeAlias =="test").Count() > 0){
    }
  • Fuji Kusaka 2203 posts 4220 karma points
    May 14, 2013 @ 17:57
    Fuji Kusaka
    0

    However i cant get Visible to work here 

    if(fd.ChildrenAsList.Where(x => x.Visible && x.NodeTypeAlias =="test").Count() > 0){

    error CS1061: 'umbraco.MacroEngines.DynamicBackingItem' does not contain a definition for 'visible' and no extension method 'visible' accepting a first argument of type 'umbraco.MacroEngines.DynamicBackingItem' could be found (are you missing a using directive or an assembly reference?)

  • Fuji Kusaka 2203 posts 4220 karma points
    May 15, 2013 @ 06:44
    Fuji Kusaka
    100

    Finally got it working.

    For some of you if you ever come across this issue here it is. 

    if(fd.ChildrenAsList.Where(x => x.GetProperty("umbracoNaviHide").Value !="1" &&  x.NodeTypeAlias =="test").Count() > 0){


    //fuji 

Please Sign in or register to post replies

Write your reply to:

Draft