Create a new custom widget in Visual Studio

To create a custom widget and implement its logic, you must first create an empty custom widget in Visual Studio. Custom widgets are independent from the project, which they are being used in. They consist of a single .dll file, which can be reused across different applications. The new widget holds the logic and functionality of the custom widget.

To create an empty custom control, perform the following:

  1. From the context menu of Sitefinity's solution, click Add » New project...
  2. From the dialog choose Visual C# » Web » ASP.NET Server Control.
  3. Name the project and click OK.
    A new project is generated under the solution. It contains only a single .cs file named ServerControl1.

    NOTE: If you rename the .cs file, you also must rename the class name inside the file.

NOTE: If your Visual Studio version is newer than Visual Studio 2012, perform the following:
  1. In Visual Studio, open the context menu of the Telerik.Sitefinity solution and click Add » New Project...
  2. Select the Class Library (.Net Framework) template and click Next.
  3. Add reference to Telerik.Sitefinity.dll.
  4. Add using Telerik.Sitefinity.Web.UI on top of class.
  5. Inherit SimpleView or SimpleScriptView.
For more information, see Inherit the built-in base class.

You can now modify the auto-generated code beside the class definition.

Was this article helpful?