SaaS CMS has officially launched! Learn more now.

Make Html.PropertyFor for ContetArea use FilteredItems?



I am using the PropertyFor to render the content in a ContentArea and that works just fine except that it iterates throught all items withoiut using FilterdItems.

<div class="knowledge-article-related">
    <div class="section-header-related toggle">
    <div class="knowledge-article-related_content inner">
        @if (Model.CurrentContent.ProductsContentArea != null && Model.CurrentContent.ProductsContentArea.FilteredItems.Any())
            @Html.PropertyFor(x => x.CurrentContent.ProductsContentArea, new { CssClass = "knowledge-article-related_item", ChildrenCssClass = "product-card product-card--hori" })

Is there a default way to have the PropertyFor use FilteredItems when redering? I know there are several ways to solve this by building my own DisplayTemplate etc, but I'm looking for a built in way.



Jan 20, 2021 10:53

Do you have any ContentAreaRenderer in your project? that can be a place where general we retrieve only filtered contents Content area items. and simply use Html.PropertyFor(x=>x.YourContentArea) in rest of the views.

Jan 20, 2021 13:09


I'm interested to understand the problem here. As far as I'm aware, rendering a ContentArea using Html.PropertyFor() will retrieve the same items as using FilteredItems. What type of items are you seeing that you shouldn't be? Expired/not published items? Items which are personalised with visitor groups? Items the user doesn't have permissions to view?

Jan 20, 2021 19:54

Hmm, could it be a bug for then? The PropertyFor gives me empty divs for expired Commerce items, could this maybe be related to Commerce only? Maybe this should have been a post in the Commerce forum. I will try with CMS items and get back to you.


Jan 20, 2021 20:23
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.