A special kind of controls used in Sitefinity CMS are the Field Controls. This article describes what they are, what they can do, how they are typically used, which ones are built-in and how to create your own Field Controls.
A field is a property of any content item in Sitefinity CMS. The built-in modules and content types have fields. When you create dynamic modules and dynamic types, you can also create fields for them. . Examples of fields are:
Field controls are tasked to provide a user interface that can read and write the value of a field.
Field controls can be used:
The notion of field controls invites the question of why you could not just use standard 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 to field controls that are not available from other controls:
The following concepts are important when working with field controls.
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 that 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.
Back To Top
Overview: Custom fields
Add new fields to widget templates
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.