Copied to clipboard

Flag this post as spam?

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


  • Ben McKean 260 posts 515 karma points
    Jan 30, 2013 @ 14:20
    Ben McKean
    0

    Xpath checkboxlist trouble getting values with Razor

    I'm using the Xpath checkboxlist to basically categorize my pages. In my case I'm categorizing news items into housing associations. This is so I can view news relevant to a housing association. I can't use tags as they are being used in addition to this.

    Where I'm listing my news items I want to be able to select news items that have a housing association ticked but I can't ever seem to get a value for the Xpath checkboxlist. Here is my code:

    var NewsItems = Model.Descendants("NewsItem").OrderBy("postDate desc");
    var housingAssociation = Model.AncestorsOrSelf().Where("NodeTypeAlias == \"HousingAssociation\"")[0]         
    NewsItems = NewsItems.Where("housingAssociation.Contains(\"" + housingAssociation.Id + "\")");   

    However when I debug the housingAssociation property of an individual news item is always empty.

    Has anybody else has this issue or know how I can resolve?

    Thanks

     

     

  • 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