Creating a Hello World Widget using Sitefinity MVC
Sitefinity widgets can be built using the new support for ASP.NET MVC. The associated video demonstrates how you can build a "Hello, World" style widget using MVC.
Step by Step
- Create a new HelloWorldController.cs class file in the folder MVC/Controllers. For an example, see the documentation Creating the controller
- Add the ControllerToolbox attribute to your controller class, as described in this article: Adding an MVC widget to the toolbox
- Create a folder named HelloWorld in the folder MVC/View so that the naming convention matches your HelloWorldController class. For another example see the documentation article Creating the View
- Add the view file Default.cshtml to the folder MVC/View/HelloWorld.
- For an example of adding a Model to your widget, see the following article: Creating the Model
- Build the project
- Create a new page in Sitefinity following the procedure Creating a new page
- Add the Hello World widget from the toolbar to the page following the procedure Adding widgets on your page
- Publish the page
- View the page in a browser, revealing the Hello World widget output.