Custom Widgets
Learn to create custom text box widgets with a button picker.
When you add or edit a data item, data fields are presented with widgets on the data form. C1 CMS provides you with a set of standard widgets used on data forms such as text boxes or drop-down lists.
A field of a certain type normally has a default widget assigned to it. Very often, you can change the default widget to a different one.
You can also create your own widgets as ASP.NET user controls (.ascx) and use them data forms:
The general approach is as follows:
- Create an ASP.NET user control.
- Register it in C1 CMS in the configuration file (~/App_Data/Composite/Composite.config).
- Use it as a widget for a proper field in a data type.
In Step 3, you can replace the default widget with your custom one by:
- either modifying the data from markup
- or making, and registering a provider for the custom widget in C1 CMS
As to creating a custom widget, you can create it as a totally new form control or extending on existing ones.
The following two examples will show you how to create:
- Example 1: A text box with a picker button to invoke a standard dialog with a tree-like structure
- Example 2: A text box with a picker button to invoke a custom dialog