Copied to clipboard

Flag this post as spam?

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


  • Martin 278 posts 661 karma points
    Oct 27, 2017 @ 12:51
    Martin
    0

    Get All Pages Based on Document Type & Property Value Checkbox List

    Hi All,

    I'm looking for some help with getting all pages within my site based on a document type & checkbox list property value.

    I have a property on a category page that determines what the page category is.

    I also have a checkbox list on an application page that I can assign multiple categories.

    I'm having issues checking if the checkbox list contain a value equal to the property on the category page.

    @{  
        var category = Model.Content.GetPropertyValue("coreCategory");
        var selection = Model.Content.AncestorOrSelf(1).DescendantsOrSelf().OfTypes("application", "service").Where(x => x.IsVisible());
    }
    
    <ul>
        @foreach(var item in selection.Where(x => x.GetPropertyValue<IEnumerable<string>>("coreCategories").Contains(category))){
            <li>
                <a href="@item.Url">@item.Name</a>
                <p>@item</p>
            </li>
        }
    </ul>
    

    My site tree looks something like this:

    Home - Page Category A - Has Dropdown to assign single Category Group - Page Category B - Has Dropdown to assign single Category Group

    • Page App A - Has Checkbox List to assign multiple Category Groups
    • Page App A & B - Has Checkbox List to assign multiple Category Groups
Please Sign in or register to post replies

Write your reply to:

Draft