Copied to clipboard

Flag this post as spam?

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


  • James 251 posts 1169 karma points
    Jan 13, 2016 @ 12:39
    James
    0

    Get child nodes with specific multi node tree picker selection

    Hello,

    I have a multi node tree picker which points to a list of nodes for selecting a category on a node.

    I am on the parent node of these nodes and i need to get all children which multi node tree picker selection match a specific string.

    razorQuery = Model.Children.Where("Visible && multiNodeTreePickerAlias == @0", myString);

    Just wondering if anyone has any advice to offer in how to achieve this as i need to get the name of the node in multi node tree picker. As the alias wont return this.

    Cheers,

    J

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Jan 13, 2016 @ 14:15
    Alex Skrypnyk
    101

    Hi James,

    What version of Umbraco are you using?

    I would use code like that :

    var ids = Umbraco.AssignedContentItem.GetPropertyValue<string>("multiPickerAlias");
    
    var selectedNames = Umbraco.AssignedContentItem.Children.Where(x => ids.Contains(x.Id.ToString())).Select(selectedChild => selectedChild.Name);
    

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft