What is the best way to force uppercase characters in a GridBoundCell of type DropDownList?
I know that the following command only works for an original textbox:
this.gbc.StyleInfo.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
The typed characters may or may not be items in the drop down list if it matters.
ADAdministrator Syncfusion Team September 9, 2004 10:11 AM
You might try handling CurrentCellValidingString and force things to be upper there.
private void gridDataBoundGrid1_CurrentCellValidateString(object sender, GridCurrentCellValidateStringEventArgs e)
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
int col = this.gridDataBoundGrid1.Binder.NameToColIndex("Col1");
if(cc.ColIndex == col)
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
int selstart = cr.TextBox.SelectionStart;
int sellen = cr.TextBox.SelectionLength;
cr.Control.Text = e.Text.ToUpper();
cr.TextBox.SelectionStart = selstart;
cr.TextBox.SelectionLength = sellen;
TSTodd SwygertSeptember 14, 2004 10:55 AM
This is not working for me. The very first character will be lowercase if the first character is not in the drop down list. If I hit the backspace key to delete the lowercase letter and then type the same lowercase letter again it will change the letter to uppercase.
Not that it matters but the cr.Control.Text = e.Text.ToUpper(); line will fire the validation event from within the validation event. If I remove the handler and add the handler from within the event, I still can''t get it to work.
Any help is much appreciated.
ADAdministrator Syncfusion Team September 14, 2004 11:21 AM
I think if you set
this.gridDataBoundGrid1.ActivateCurrentCellBehavior = GridCellActivateAction.SetCurrent;
you can avoid this problem. If you do not want to use this SetCurrent property, then you can try handling grid.KeyDown.