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.

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?