This section of the documentation is going to describe a specific kind of controls used in Sitefinity CMS called Field Controls. It is going to explain what are the intended usage scenarios and supported functionality of field controls, what are the field controls available out of the box and how you can create custom ones.
Field controls are controls, which have two primary tasks:
A field in this context is the property of any content item in Sitefinity CMS. When you create dynamic modules and dynamic types, you can also create fields for them. The built-in modules and content types also have fields. Examples of fields are:
Those are the fields, whose values field controls have the job of reading and writing.
Note: When we talk about items in the context of field controls, we mean content items, whose fields are edited or displayed by the field control (i.e. news items, events, images, etc.)
We mentioned that there are two primary tasks each field control has to solve – read and write the value of a single field. When we think about this, we can guess where those field controls can be used.
You can also use field controls in any other scenario, where you want to read or write the value of a single field. We will look at how we can use them in the section for building field controls.
You may be wondering why we need to introduce a new concept for field controls. Can’t we just use normal ASP.NET controls and HTML tags for these needs? Can’t we use a normal dropdown to select the value of a field or a normal textbox? The answer is – you can. However, there are advantages that field controls give you, which are not available when working with normal controls.
As mentioned, you can (and should) provide many views to work with an item in your custom modules. You can have different UI for inserting, editing and viewing an item. To support these different views, field controls have a DisplayMode property, which can be either Read or Write. Read mode is used when you want to display the value of a field (view), Write mode is used when you want to edit the value of a field (insert, edit).
The UI of a field controls is always different in Read and Write mode. The mode is switched automatically by Sitefinity CMS, depending on the context in which the field control is used. Sometimes the UI in the different modes is drastically different, and usually more complex in Write mode. If we have a field, which will associate an item with a category, then it should only display the category’s name in Read mode, maybe as a link. But when in Write mode, the field control should make it possible for the user to select from pre-existing categories or create new ones to associate the item with.
It is good to have this concept in mind every time when dealing with field controls.
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
Overview: Custom fields
Add new fields to widget templates
Copyright © 2019 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