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

    Combine 2 Selections

    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 6450 karma points MVP 6x 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.

  • 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