Hybrid MVC mode


You can think of Hybrid mode as a way to use the best of both worlds – MVC and WebForms. Hybrid mode lets you use MVC widgets and WebForms widgets on the same page. You can implement your controllers the way you are used to, and at the same time have WebForms controls that use postbacks. This might sound weird to some, but we decided to give you as many options as we can.

Create a hybrid template and page

To use Hybrid mode in Sitefinity CMS, you must create a template and set it up accordingly. In the Create a template dialog, perform the following:

  1. Enter a name.
    For example, HybridTemplate
  2. Click Select another Template.
    The Select a template dialog appears.
  3. Choose a template under Hybrid templates.

Once created, this template and all pages based on it can use both the old WebForms widgets, as well as custom MVC widgets.

In order for this to work, the Sitefinity CMS engine creates a page object, but also routes to all MVC controllers that you have on the page and inserts their markup into the output. This works in exactly the same way that ASP.NET MVC does, so there are no hacks or workarounds – you can fully expect your controllers to behave like they would normally.

There is one caveat. Since WebForms requires that you only have a single HTML form tag on the page, you cannot use the default @Html.BeginForm helper. We have provided an alternative for you, which you can use instead. Everywhere that you need to render a form, you can use @Html.BeginFormSitefinity.

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?