New to Telerik UI for WinForms? Download free 30-day trial

Set CharacterCasing for GridViewComboBoxColumn

Environment

Product Version Product Author
2020.3.1020 RadGridView for WinForms Lance McCarthy

Description

Currently, you cannot set CharacterCasing for a GridViewComboBoxColumn's editor via a top-level property.

Solution

You can use the RadGridView CellEditorInitialized event to access the RadDropDownListEditor. With that reference, you can set the internal TextBoxItem's CharacterCasing property directly.

Here is an example where we enforce Upper-Case:

private void RadGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    var ddlEditor = e.ActiveEditor as RadDropDownListEditor;
    if (ddlEditor != null)
    {
        var element = ddlEditor.EditorElement as RadDropDownListEditorElement;
        element.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;
        element.TextBox.TextBoxItem.CharacterCasing = CharacterCasing.Upper;
    }
}
Private Sub RadGridView1_CellEditorInitialized(ByVal sender As Object, ByVal e As GridViewCellEventArgs)
    Dim ddlEditor = TryCast(e.ActiveEditor, RadDropDownListEditor)
    If ddlEditor IsNot Nothing Then
        Dim element = TryCast(ddlEditor.EditorElement, RadDropDownListEditorElement)
        element.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown
        element.TextBox.TextBoxItem.CharacterCasing = CharacterCasing.Upper
    End If
End Sub

See Also

In this article