IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
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.
Mvc
Views
System.Web
System.Web.Mvc
Telerik.Sitefinity
Telerik.Sitefinity.Mvc
Telerik.Sitefinity.Frontend
In case you are creating the MVC views and .CSHTML files in an external assembly. However, this results in not 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.
AssemblyInfo.cs
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers.Attributes;
[assembly: ControllerContainer]
Models
MessageWidgetModel.cs
Controllers
MessageWidgetController.cs
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.
System.Web.Mvc.Controller
Index
ActionResult
Message
Model
Mvc/Views/MessageWidget
NOTE: TheRaw helper method is introduced in MVC 3 and it helps to output any HTML without encoding it.
Raw
MyFirstMvcWidget
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
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important