Copied to clipboard

Flag this post as spam?

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


  • rendervouz 6 posts 126 karma points
    Sep 07, 2016 @ 07:27
    rendervouz
    0

    Is there any way to combine 2 selections?

    For example:

    I'd like to get the children of a node with id "1168" and "1169"

    var selection = Umbraco.Content(1168).Children("news")

    var selection = Umbraco.Content(1169).Children("news")

    I've tried with

    var selection = Umbraco.Content(1168|1169).Children("news")

    But it won't show anything. Is there any possible way to combine 2 selections?

    Thanks

  • Dennis Adolfi 1082 posts 6446 karma points MVP 5x c-trib
    Sep 07, 2016 @ 09:19
    Dennis Adolfi
    100

    Hi rendervouz.

    Try doing like this with typed models:

     var selection = Umbraco.TypedContent(1168,1169).SelectMany(content => content.Children.Where(child => child.DocumentTypeAlias == "news"));
    

    Best of luck.

Please Sign in or register to post replies

Write your reply to:

Draft