Create a widget template
Custom widgets are usually represented by a class, which implements their functionality. The mechanism of creating widgets in Sitefinity CMS allows you to specify a template. With a template you can specify the visual representation of your widget. A template is represented by an .ascx file.
To create a widget template:
- In the context menu of your project, click Add » New Folder.
Name the folder, for example, MyCustomWidgetFolder.
- From the context menu of the new folder, click Add » New Item...
- From the dialog click Visual C# » Code » Code File.
- Name the file the way you want your widget to be displayed in the toolbox, for example MyCustomWidget.ascx.
- Click Add.
An empty .ascx file is generated under the MyCustomWidgetFolder folder.
- From the context menu of file MyCustomWidget.ascx, select Properties.
- In the Properties pane, set the Build Action property of the file to Embedded Resource.
You do this to make the template a part of the compiled assembly.