When working with dynamic content items with dynamic fields, you may need to display only a portion of these content items in the frontend. With Sitefinity CMS, you can filter programmatically the content items by their dynamic fields.
For example, you have a Movie collection dynamic content item and you may need to filter this collection to show only movies from a particular genre, designated by a dynamic field. For more details and sample code for this example, see Example: Filter dynamic content items by dynamic field.
This article describes the concept and procedure how to filter dynamic content items by a dynamic field.
Before filtering items by a field, we recommend to check if the dynamic field exists and is not removed, for example. The following code demonstrates how to do this:
Before you begin filtering your dynamic content items, you need to get an instance of the DynamicModuleManager class.
Next, you need to get the type of the dynamic content item by using the TypeResolutionService class.
To filter dynamic content items, you use IQueryable extension methods - the Where() method and pass a string predicate. To do this, you must include the following namespace in your code:
By using the Where() extension method, execute complex string predicates.
In addition, you can filter dynamic content items by the following dynamic field types:
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2023 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity