Copied to clipboard

Flag this post as spam?

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


  • Paul Griffiths 358 posts 998 karma points
    Feb 27, 2016 @ 12:40
    Paul Griffiths
    0

    Getting dropdown property value from descendant

    Hi All,

    Can someone please explain why this works. I want to retrieve all property listings where the proeprtyCategory value is set to 'To Let' in a drop down data type

    var propertiesToLet = Model.Content.Descendants("propertyListingPage").Where(x => x.GetPropertyValue<bool>("propertyCategory")).ToList().OrderBy("CreateDate desc");
    

    and this doesnt

    var propertiesToLet = Model.Content.Descendants("propertyListingPage").Where(x => x.GetPropertyValue<string>("propertyCategory == To Let")).ToList().OrderBy("CreateDate desc");
    

    enter image description here

    many thanks

    Paul

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Feb 27, 2016 @ 13:14
    Jeavon Leopold
    100

    I think just a little syntax issue:

    var propertiesToLet = Model.Content.Descendants("propertyListingPage").Where(x => x.GetPropertyValue<string>("propertyCategory") == "To Let")).ToList().OrderBy("CreateDate desc");
    
  • Paul Griffiths 358 posts 998 karma points
    Feb 27, 2016 @ 20:54
    Paul Griffiths
    0

    Hi Jeavon,

    Thanks for the response, sorry for the late reply ive been out all day.

    You are absolutely correct though, what you suggested works just fine.

    Thanks for you help

    Paul

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Feb 27, 2016 @ 20:56
    Jeavon Leopold
    1

    Great!

  • 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