Condividi tramite


Editor Controls for Field Type Properties

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

An editor control for the variable properties of a field type can be used, as an alternative to a PropertySchema Element (Field Types), to render the properties of the field on the New Site Column, Change Site Column, Create Column, and Change Column pages. See Custom Field Type Property Rendering for an overview of the two options and a discussion of when to use each method.

Creating an Editor Control

An editor control is defined in an .ascx file in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\ControlTemplates and in a code-behind file that are compiled into the same assembly as the custom field class. In addition to rendering the properties of the field, the editor control supports column creators who are setting those properties with special functions, such as complicated computational logic, look-up of values from data sources, and custom data validation.

Note   We recommend that you name your editor control classes using the following naming convention:

field_type_nameFieldEditor

for example, TargetDateFieldEditor or RegularExpressionFieldEditor. In line with this convention, your .ascx file will be named field_type_nameFieldEditor.ascx and will inherit from the code-behind class field_type_nameFieldEditor.

The IFieldEditor Interface

To act as a field editor user control, the code-behind class must do the following:

The IFieldEditor interface includes the following property and methods. Click the name of each to learn more about how to implement it.

  • DisplayAsNewSection   Use this property to specify whether or not you want the control to be displayed in the Additional Column Settings section on the New Site Column, Change Site Column, Create Column, and Change Column pages, or alone in a new section.

  • OnSaveChange   Use this method to validate and save a column-creator's or column-editor's changes to the field (column) properties.

  • InitializeWithField   Use this method to initialize the editor control with either default values or the current property values of the field (column).

See Also

Concepts

Custom Field Types

Custom Field Classes

Custom Field Type Definition