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.
You can use the following procedure as a guideline for building a custom widget.
First, you create a class and inherit from the SimpleView class. There are some abstract methods and properties you have to override. Then, you can add the public properties that will show up in the dialog. In this tutorial, it is the Message property. Then, you can add control references for the controls added in the template.
SimpleView
Message
As with all Sitefinity CMS widgets that inherit from SimpleView, you must override the InitializeControls method. You can think of this as an alternative of the CreateChildControls method in custom ASP.NET controls. You can implement your control’s logic here.
InitializeControls
CreateChildControls
MessageLabel
null
This is not specific to field controls, but all widgets that inherit from SimpleView. Note that this property is obsolete. You can use the LayoutTemplatePath instead. You can return null or String.Empty in your project.
LayoutTemplatePath
String.Empty
Although it is not abstract, we recommend that you override the LayoutTemplatePath property. Similar to all widgets in Sitefinity CMS, you should return a path to the template used by your widget. You can either use a path to an embedded resource (recommended), or an external file. For more information, see VirtualPathProvider.
Use the following code sample:
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