The following tutorial demonstrates how to make the template of a custom widget to be editable through the UI.
Perform the following:
NOTE: You must use an instance of the PageManager class to operate with widget templates. In the code sample below, a specific widget template is retrieved with specific Name, AreaName, DataType, and ControlType.
Use the following code sample:
To register and use the custom resource class in Global.asax, register the class by subscribing to SystemManager.ApplicationStart method in the ApplicationStart event. The registered custom resource class can be further extended with additional resource entries from Administration » Interface Labels and Messages.
Register the widget template for the control using the resource class entries.
All editable templates are stored in the Sitefinity CMS database. If you edit the templates through the UI, those edits are kept in the database and the template is served from there when the widget is instantiated. If there are no edits, Sitefinity CMS returns the embedded resource. Keeping the templates in the database also gives the possibility to reset them to the default ones. You can always go back one version in the embedded resource, if someone has made the template unusable from the UI.
To create such a database record for your template, you can use the Sitefinity CMS API. You can do this only once in the lifetime of your project in the SystemManager.ApplicationStart method:
The code above creates a new entry in the database with the information you give for your template. That information includes the namespace of your ascx embedded resource, type of the widget, name for the template to display in the UI, the assembly it resides in, etc. From now on your template will be retrieved from the database and will appear in the backend list.
You can also manage templates through the custom control designer. For more information, see Manage custom control templates through the designer.
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
Copyright © 2022 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity