New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Auto-Generated Editors

Editable columns inside a RadGrid control supply a default editor that enables users to edit the values in the column. The editor is specified by the ColumnEditor property of the column, which is of type IGridColumnEditor.

Editable columns are columns that implement the IGridEditableColumn interface.

Default Column Editors

The following table lists the default column editors for each of the built-in editable column types:

 

Column type Default column editor Column editor base class
GridBoundColumn GridTextBoxColumnEditor GridTextColumnEditor
GridDropDownColumn GridDropDownListColumnEditor GridDropDownColumnEditor
GridCheckBoxColumn GridCheckBoxListColumnEditor GridBoolColumnEditor
GridDateTimeColumn GridDateTimeColumnEditor GridTextColumnEditor
GridNumericColumn GridNumericColumnEditor GridTextColumnEditor
GridMaskedColumn GridMaskedColumnEditor GridTextColumnEditor
GridHTMLEditorColumn GridHTMLEditorColumnEditor GridTextColumnEditor
GridTemplateColumn GridTemplateColumnEditor GridColumnEditorBase
GridBinaryImageColumn GridBinaryImageColumnEditor GridColumnEditorBase

The purpose of column editors is to define the style of the controls in edit mode. Note that using column editors for modifying the functionality of the edit controls is not recommended.

If you want to change properties of a GridDateTimeColumn editor related to the calendar or time view, use their SharedCalendar or SharedTimeView properties.

Accessing the column editors programmatically

The autogenerated column editor is available when the item is in edit mode.

<MasterTableView ...>
  <Columns>
    <telerik:GridNumericColumn UniqueName="MyNumericColumn" DataField="ItemNumber" ... />
  </Columns>
</MasterTableView>          
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item.IsInEditMode)
    {
        GridEditableItem item = e.Item as GridEditableItem;
        GridNumericColumnEditor numericEditor = (GridNumericColumnEditor)item.EditManager.GetColumnEditor("MyNumericColumn");
    }
}
Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemCreated
    If e.Item.IsInEditMode Then
        Dim item As GridEditableItem = TryCast(e.Item, GridEditableItem)
        Dim numericEditor As GridNumericColumnEditor = DirectCast(item.EditManager.GetColumnEditor("MyNumericColumn"), GridNumericColumnEditor)
    End If
End Sub

Custom column editors

You can replace the default column editor with a custom editor. By supplying a custom column editor, you can provide a column with enhanced functionality such as validation, rich-text editing, third-party controls, and so on.

Once created, you can easily re-use your custom column editors for other grid implementations.

In this article