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. Image for the cookie policy date
close icon

Backspace key

I have AutoComplete comboBox inside GridGrouping Control. When the cursor is inside the field it seems that Backspace and Delete doesn't work like with other text fields.
Do I need to override TableControlCurrentCellKeyDown event for Backspace and Delete keys? Do you have any examples?


Thanks a lot.

1 Reply

HA haneefm Syncfusion Team May 15, 2007 10:24 PM UTC

Hi Natalia,

This can achieved by handling the CurrentCellKeyDown event and accordingly the Delete key is processed for the combobox cell to resolve this issue. The following is the code snippet.

private void gridTableControlCurrentCellKeyDown(object sender,GridTableControlKeyEventArgs e)
{
GridCurrentCell cc =e.TableControl.CurrentCell;
if(cc.Renderer.StyleInfo.CellType == GridCellTypeName.ComboBox )
{
if(e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
{
e.Inner.Handled = true;
GridDropDownEditPartControl editControl = cc.Renderer.Control as GridDropDownEditPartControl;
int len = ( editControl.SelectionLength > 0 )? editControl.SelectionLength : 1;
int start = editControl.SelectionStart;
if( ( editControl.SelectionStart + len ) <= editControl.Text.Length)
cc.Renderer.ControlText = cc.Renderer.ControlText.Remove( editControl.SelectionStart,len);
editControl.SelectionStart = start;
}
}
}

Also refer this forum thread for more details.
http://www.syncfusion.com/Support/Forums/message.aspx?&MessageID=26118

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon