Customize the default view of widgets through widget definitions

Widget definitions, or, control definitions in Sitefinity CMS are a developer concept that enables building structured declarative user interfaces. They facilitate reuse of components when building the backend user interface (UI) and also enable third-party developers to plug their own components to extend that UI. For more information about definitions, see For developers: Build the backend UI with Control definitions.

Each widget definition consists of views for the backend and the frontend that represent a specific UI, for example for actions like Edit, Insert, View Preview, and so on. In some cases, you need to extend the default functionality the UI views for the needs of a more complex scenario. To do that, you need to replace the default view with your custom one through the widget definitions.

Sitefinity's ContentView class and all its inheritors (widgets such as News, Blog Posts, Events, and so on) are important elements that build the Sitefinity CMS experience. They enable you to select the data you want to display, as well as data's behavior on the frontend.

This article demonstrates how to inherit from a ContentView class and directly manipulate its DataSource property to result in frontend filtering in any News widget. As every other widget that is derived from the ContentView class, the widget derived from the NewsView class also has a Master and a Details view. Since you want to filter the list of items displayed by the widget, you need to modify the News widget List of news template and inherit from its MasterView class.

You can download and set the template and map the new template to the News widget. Alternatively, you can do the whole procedure from scratch.

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?