Filter dynamic content items by URL

With the support of hierarchical dynamic modules, Sitefinity CMS provides the option to filter the dynamic content items by their parents. The following procedure describes how to filter dynamic content items by their parent via the URL.

Once you activate the dynamic module, a corresponding section is created in Sitefinity CMS toolbox with both Standard and MVC widgets reflecting the names of the content types.

EXAMPLE: For a module with name Travelling Agency, a section with name Travelling Agency is created. For Countries dynamic content type, two widgets are automatically added to the toolbox section - Countries and Countries MVC.

To filter the dynamic content items by their parents, perform the following:

  1. Create a new page with name Cities and drop the Cities MVC widget on the page. 
  2. Click Edit to open the widget designer.
  3. In the Content tab, select From currently open country radio button and click Save.
    As a result, the widget designer informs you that only Cities from the currently open Countries will be displayed:
    CitiesDesigner
    For more information, see Dynamic items selector.
  4. Save your changes, publish the page, and open it on the frontend.
    The page displays an empty list.
  5. To choose whether you want to display the whole list of items when no country is specified in the URL, in the widget designer, click Advanced » Model.
    In ShowListViewOnEmpyParentFilter, enter true or false. In this scenario, leave the default value, which is false.
  6. To filter the cities by country, add a name of a country to the URL.
    For example, http://domain:xxx/cities/bulgaria
    A list of all the cities in Bulgaria appears. If you click an item title, by default you are redirected to the Detail view of the item.
  7. To choose whether to open the Detail view when an item is clicked, in the widget designer, click Advanced » Model
    In ListMode, enter true or false. True means that the detailed mode will not be opened.
    In this scenario, leave the default value, which is false.

    NOTE: You can also display a list of dynamic content items and highlight the selected one. For more information, see Highlight filtered items.

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?