Copied to clipboard

Flag this post as spam?

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


  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    Apr 30, 2015 @ 13:10
    Søren Kottal
    0

    How to query for mntp-value?

    How can I query for nodes using this?

     

    Something like newsList.Children().Where(x => x.GetPropertyValue<IEnumerable<IPublishedContent>>("services").Contains(Umbraco.Content(1136))).

     

    But that gives me an error. CS1593: Delegate 'System.Func<Umbraco.Core.Models.IPublishedContent,int,bool>' does not take 1 arguments

     

    Can anyone help? :)

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Apr 30, 2015 @ 22:30
    Jeavon Leopold
    0

    Hi Søren,

    Can I check that you want to check if a certain node is selected within the MNTP?

    Thanks,

    Jeavon

  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    May 04, 2015 @ 08:39
    Søren Kottal
    0

    Exactly Jeavon.

     

    Say I have a node A, with node 1, 2 and 3 selected within the MNTP.

     

    I then want to query for nodes where node 2 is selected, where node A should show up.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 04, 2015 @ 16:42
    Jeavon Leopold
    103

    Ok you should be able to do this:

    newsList.Children().Where(x => x.GetPropertyValue<IEnumerable<IPublishedContent>>("services").Contains(Umbraco.TypedContent(1136)));
    

    But you might find better performance from checking against IDs:

    newsList.Children().Where(x => x.GetPropertyValue<IEnumerable<IPublishedContent>>("services").Select(y => y.Id).Contains(1136));
    
  • Søren Kottal 713 posts 4571 karma points MVP 6x c-trib
    May 06, 2015 @ 07:46
    Søren Kottal
    0

    Thanks, Jeavon, just what I needed :)

  • hassanisback 8 posts 78 karma points
    Feb 21, 2018 @ 16:35
    hassanisback
    0

    I got similar query. Say I want to render only those products in my section which have the similar tags of my current page. So if I am at the product A page, I want to render only the image (in a section) who has tagged with product A. How can I achieve this? So far I have tried `

        var selection = Umbraco.TypedContent(1534).Children()
                        .Where(x => x.IsVisible())
                            .Where(x => x.productTags == "tag1");
    

    which says: CS1593: Delegate 'System.Func

    Any help?

    Thanks in advance.

  • 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