Feather MVC-based widgets differ from the standard Sitefinity CMS widgets by their design and functionality. These widgets come with new property editors based on the Bootstrap framework and AngularJS. For the UI of these widget Feather provides predefined packages based on different frontend frameworks that provide built-in styling options for your website.
For more information, see feather-packages and feather-widgets repositories on Sitefinity CMS GitHub.
The following tutorial demonstrates how to create a new Feather MVC widget.
NOTE: You can also create the Class Library in the SitefinityWebApp project and not necessarily in an external project.
In some cases, you need to create the MVC views and .CSHTML files in an external assembly. This, however, results in having the Code IntelliSense feature of Visual Studio not enabled and you do not get the suggestions and autocomplete for your code.
NOTE: You need to make sure Telerik.Sitefinity.Feather.Core NuGet package in the class library project is the corresponding version as the one in the SitefinityWebApp project.
To enable Code IntelliSense in Visual Studio:
NOTE: In case you complete this step for all build modes (Debug and Release, by default), the compiler will always output the .DLL files in ~/bin folder, instead of the default bin/Debug and bin/Release folders. As a result, all build configuration modes will output to the one and the same path. If, for the Release build, you do not modify the output path from bin/Release/ to bin/, Code IntelliSense is not enabled for the Release build.
NOTE: This web.config file is only used to enable the Code IntelliSense feature. All other configurations must be made in the web.config file of the SitefinityWebApp project.
Your controller must inherit the System.Web.Mvc.Controller class. You add an Index method that returns an object of type ActionResult. The Index action returns a list of items from the model. You modify the code of the Index action to populate the Message of the Model.
NOTE: The Raw helper method is introduced in MVC 3 and it helps to output any HTML without encoding it. You use the Raw method only when you trust the source of the embedded resource. In case you want to ensure your HTML content is safe, leverage Sitefinity CMS HTML sanitization.
You can use the widget from the MvcWidgets section on any page.
NOTE: The target .NET framework of the SitefinityWebApp project and the MyFirstMvcWidget project must be the same.
Back To Top