Custom filtering of MVC Events widget

MVC events widget contains various predefined options to filter the list of displayed events. Although you can adjust almost every setting in the designer, you may want to extend the business logic behind some of these default filtering options. This tutorial will demonstrate how to extend a Events widget.

Perform the following: 

  1. Create a new class that represents you new business logic for the Events widget.
    Create a CustomEventModel class that inherits from the default EventModel.
    In this example, you additionally filter all events with title that contains Some Title text:
  2. Replace the original implementation of the Events widget model with the new model. 
    You do this using the Bootstrapper.Bootstrapped event.
    Place the following code in your Global.asax file:

RESULT: You changed the default filtering of events due to the many virtual implementations of all controller methods and model methods.

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

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to 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?