We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Upper case in drop down list

Thread ID:

Created:

Updated:

Platform:

Replies:

18810 Sep 9,2004 02:35 PM UTC Sep 14,2004 04:21 PM UTC WinForms 3
loading
Tags: GridControl
Todd Swygert
Asked On September 9, 2004 02:35 PM UTC

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. Thank you, Steve

Administrator [Syncfusion]
Replied On September 9, 2004 03:11 PM UTC

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;
	}
}

Todd Swygert
Replied On September 14, 2004 03:55 PM UTC

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.

Administrator [Syncfusion]
Replied On September 14, 2004 04:21 PM UTC

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.
private void gridDataBoundGrid1_KeyDown(object sender, KeyEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(!cc.IsEditing)
		cc.BeginEdit();
}

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;