Customizing editor behavior
The look and behavior of grid editors can be changed programmatically. This can be done either in CellBeginEdit or in CellEditorInitialized events.
CellBeginEdit: Fired when the editor is created.
CellEditorInitialized: Fired when the editor is created and initialized with a predefined set of properties.
The following sample demonstrates how to change the default ForeColor of GridSpinEditor:
void radGridView1_CellBeginEdit(object sender, Telerik.WinControls.UI.GridViewCellCancelEventArgs e)
{
GridSpinEditor editor = this.radGridView1.ActiveEditor as GridSpinEditor;
if (editor != null)
{
((RadSpinEditorElement)editor.EditorElement).ForeColor = Color.Red;
}
}
Private Sub RadGridView1_CellBeginEdit(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCellCancelEventArgs) Handles RadGridView1.CellBeginEdit
Dim editor As GridSpinEditor = TryCast(Me.RadGridView1.ActiveEditor, GridSpinEditor)
If editor IsNot Nothing Then
CType(editor.EditorElement, RadSpinEditorElement).ForeColor = Color.Red
End If
End Sub