Edit this page

Changing the Default Editors

By default the grid is using the underlying field data type to determine the editor type. If you want to change the default editor you should use the EditorReqired event. For example the following snippet shows how you can change the default text editor to VirtualGridDropDownListEditor.


private void RadVirtualGrid1_EditorRequired(object sender, VirtualGridEditorRequiredEventArgs e)
{
    if (e.ColumnIndex == 1)
    {
        VirtualGridDropDownListEditor dropDownListEditor = new VirtualGridDropDownListEditor();
        RadDropDownListEditorElement element = dropDownListEditor.EditorElement as RadDropDownListEditorElement;
        element.DataSource = new string[] { "Mr.", "Mrs.", "Ms.", "Dr." };
        e.Editor = dropDownListEditor;
    }
}

Private Sub RadVirtualGrid1_EditorRequired(ByVal sender As Object, ByVal e As VirtualGridEditorRequiredEventArgs)
    If e.ColumnIndex = 1 Then
        Dim dropDownListEditor As New VirtualGridDropDownListEditor()
        Dim element As RadDropDownListEditorElement = TryCast(dropDownListEditor.EditorElement, RadDropDownListEditorElement)
        element.DataSource = New String() {"Mr.", "Mrs.", "Ms.", "Dr."}
        e.Editor = dropDownListEditor
    End If
End Sub
Private Sub DefineColumnDataType()
    '#Region "DefineColumnDataType"
    Me.radVirtualGrid1.MasterViewInfo.ColumnDataTypes(0) = GetType(Integer)

See Also