Dependencies when working with hybrid page templates
In Sitefinity CMS, you can work with both MVC and Web Forms widgets on the same page. You do this by applying a hybrid page template to the pages that need to leverage both technologies.
First, you create a hybrid page template via the Layout editor. For more information, see Create page templates. Next, you apply this template by either:
- Selecting the template when creating a new page
- Applying the template to a page in the Layout editor
The following table lists key MVC characteristics and dependencies and how to make sure MVC technology works properly on your hybrid template.
||For MVC Grid widgets to function properly in your layout design, you need to copy the GridSystem folder, located in the \SitefinityWebApp\ResourcePackages\Bootstrap\ folder and paste it in the root of your project.
|Widget templates and views
||For MVC widget templates and views to be properly loaded and rendered, you need to copy the Mvc folder, located in the \SitefinityWebApp\ResourcePackages\Bootstrap\ folder and paste it in the root of your project.
|Bootstrap and CSS
To style your MVC widgets properly, you link the CSS to Bootstrap by one of the following:
The main.min.css file is located in the \SitefinityWebApp\ResourcePackages\Bootstrap\assets\dist\css\ folder.
- Add the CSS to the theme
- Add the CSS to the page template via a CSS widget
|Modifying widget templates
||When using an MVC widget on a hybrid template, you modify the template in the Mvc folder, as opposed to the ResourcePackages folder, so that the changes take effect on the hybrid page. All changes to grid and widget templates as well as layout files must be made in the root MVC folder, as opposed to the resource package, since when in hybrid mode, resource packages do not work. You might need to manually move templates from the resource package folder to the MVC folder or link CSS files from a resource package to a layout file in the root MVC folder.
NOTE: If there is no widget template in the package, Sitefinity CMS uses the template from the ~/Mvc folder.
MVC widget templates are located in Design » Widget templates and not in the ResourcePackages folder. These templates are used for both MVC only and hybrid templates.
To add templates in the file system, you can also create a folder with the same name as the dynamic module (in singular).
Everywhere you need to render a form, you use the @Html.BeginFormSitefinity helper.
NOTE: Web Forms requires that you only have a single HTML form tag on the page, you cannot use the @Html.BeginForm helper.