Copied to clipboard

Flag this post as spam?

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


  • JamesW 18 posts 128 karma points
    Sep 30, 2019 @ 11:17
    JamesW
    0

    Filter by custom property in partail view

    Hi

    In Umbraco 7 I would have just used: var home = CurrentPage.Site(); var filtered = home.Children.Where("PropertyName == @0", false)

    Any idea how I transfer this to Umbraco 8?

    So far I now use: @inherits Umbraco.Web.Mvc.UmbracoViewPage And get the home page with: var home = Model.Root();

    But I can't find how to filter by a property name.

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 30, 2019 @ 11:26
    Shaishav Karnani from digitallymedia.com
    100

    You can do following to get above results:-

    var home = Model.Root();
    home.Children().Where(x=>x.Value("PropertyAlias") == false);
    

    This is good link that shows new Properties Reference for Umbraco 8.

    https://our.umbraco.com/documentation/reference/querying/ipublishedcontent/Properties/

    Cheers,

    Shaishav

  • JamesW 18 posts 128 karma points
    Sep 30, 2019 @ 11:36
    JamesW
    0

    Thank you and thanks for the link, I was looking in the wrong place in the documentation so couldn't find it!

Please Sign in or register to post replies

Write your reply to:

Draft