Filter dynamic content items by related data

Similar to filtering the related data items for standard widgets, dynamic MVC widgets also support filtering by related data items.

PREREQUISITES: You have added Related data custom field of type News to the Cities dynamic content type and name the field CityGuide.

Perform the following:

  1. Create a new page with name RelatedData that uses the Bootstrap.default template.
  2. Drag the News MVC widget on the page.
  3. Drag the Cities MVC widget on the page.
  4. Click the Edit button of the Cities MVC widget.
  5. Click Advanced » Model.
  6. Set the following related data properties:
    • RelatedFieldName
      This is the name of the related data field.
      Enter CityGuide
    • RelatedItemType 
      This is the full type name of the related data field.
      Enter Telerik.Sitefinity.News.Model.NewsItem
    • RelationTypeToDisplay 
      This is the relation type that specifies whether related items are children or parents of the source item.
      Enter Parent
    • RelatedItemProviderName 
      This is the name of the provider that the related data uses.
      Leave empty.
  7. Click Save, publish the page, and open it on the frontend.
    You will see all cities and all news items on the page.
  8. Click on a news item.
    As a result, you will be navigated to the Detail view of the news item and cities will be filtered so that only those, which the news item is related to, are being displayed.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?