Hi Wirawan,
If you want to handle the "Delete" Key stroke in a grid cell, you need to handle the CurrentCellKeyDown event of the grid. Here is a code snippet to show this.
private void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Delete )
{
GridDataBoundGrid _grid = sender as GridDataBoundGrid;
GridCurrentCell _currentCell = _grid.CurrentCell;
if( _currentCell.IsEditing)
{
GridTextBoxCellRenderer _Renderer = _currentCell.Renderer as GridTextBoxCellRenderer;
if( _Renderer != null)
{
e.Handled = true;
int iSelectionLength = _Renderer.TextBox.SelectionLength;
_Renderer.TextBox.SelectionLength = iSelectionLength > 0 ? iSelectionLength : 1;
_Renderer.TextBox.SelectedText = String.Empty;
}
}
}
}
Please refer to the attached sample for more details.
WindowsApplication94.zipBest Regards,
Haneef