Types of forms: MVC Forms and Web Forms
With Sitefinity CMS, you have the option to use MVC forms or Web Forms forms. The following sections look into details into both options.
MVC forms are part of ASP.NET MVC framework and are the recommended way to work with forms in SItefinity CMS. MVC technology provides a modern, convention-based, mobile-first UI framework to quick and easy setup and design of forms and applications. Thanks to the MVC pattern, you can separate development into views, logic, and processing. For more information, see For developers: Develop with Sitefinity and ASP.NET MVC.
- Full control over the markup of a form
- Customize the out-of-the-box form fields and elements by following the Feather conventions
- API for RAPID development of custom form fields and elements
PREREQUISITES: To use MVC forms on pages, page templates need to be either in Hybrid MVC mode, or in Pure MVC mode.
With MVC forms, you can work with the API for RAPID development of custom form fields and elements by benefiting from the Sitefinity CMS MVC framework to build mobile-ready sites using frameworks of your choice. This includes MVC built-in widgets, an AngularJS widget designer framework, and Bootstrap framework out-of-the-box. For more information, see Form widget.
Web Forms are part of ASP.NET web application model. Web forms are basically pages users request on your site. The page is compiled by the framework and then an HTML markup is generated and rendered in the website.
You can easily create web forms in Visual Studio by utilizing the rich server controls, setting properties, methods, and events for controls that define the web page's behavior, look and feel, and so on.
With web forms you benefit from all ASP.NET features:
- Based on Microsoft ASP.NET technology, in which code that runs on the server dynamically generates Web page output to the browser or client device.
- Compatible with any browser or mobile device. An ASP.NET Web page automatically renders the correct browser-compliant HTML for features such as styles, layout, and so on.
- Compatible with any language supported by the .NET common language runtime, such as Microsoft Visual Basic and Microsoft Visual C#.
- Built on the Microsoft .NET Framework. This provides all the benefits of the framework, including a managed environment, type safety, and inheritance.
- Flexible because you can add user-created and third party controls to them
For more information, see ASP.NET documentation.
MVC forms or Web forms
When it comes to choosing the type of forms to use on your website, you need to consider which model suits best your requirements, needs, and knowledge base. The recommended approach for straightforward development and improved productivity is to work with ASP.NET MVC framework to build websites and interfaces, widgets, interactions, and applications.
Keep in mind that with Sitefinity CMS, you can use both frameworks on one page if the page layout is set to Hybrid mode. For more information, see MVC modes.
Some important points to consider:
- Standard Web Forms are convenient for business users that take advantage of their core functionality
- The two types of forms have different form widgets and layout widgets
- You can use MVC forms not only in Hybrid mode, but in Pure MVC mode, unlike standard Web Forms
- With MVC, you get all the features of standard forms plus full control over the markup of the form, that is, visual components and UI
- With MVC, development effort is considerably shortened because of convention-based templates for field controls, that is, easily switch layout in accordance with package, without messing with the form content itself
- With MVC, you have full control over the markup of a form
- With MVC, you can easily customize the out-of-the-box form fields and elements by following the existing Feather conventions and register register custom HTML5-based fields
- When working with MVC forms, the target framework on the page is also applied to the forms
For more information about the differences between ASP.NET MVC and Web forms technology, see Reference: ASP.NET MVC and Web forms.
Work with both types of forms
Using one of the frameworks does not mean you cannot work with the other, as well. If you decide to start implementing MVC forms does not mean that existing web forms will no longer work. You can:
- Use web forms and MVC forms in parallel when working in MVC Hybrid mode.
- Migrate your web forms to MVC forms. For more information, see Migrate web forms to MVC forms.
Both types of forms can post to the same storage.