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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Delete button cannot function

Thread ID:

Created:

Updated:

Platform:

Replies:

53772 Dec 20,2006 06:51 AM UTC Dec 21,2006 01:18 AM UTC Windows Forms 2
loading
Tags: GridControl
Ngurah Wirawan
Asked On December 20, 2006 06:51 AM UTC

Hi all,

if we try to type something on the cell, and try to press delete button, there is nothing happen. i have attached simple program to replicate my issue.

regards,
wirawan

WindowsApplication94.zip

Administrator [Syncfusion]
Replied On December 20, 2006 10:22 AM UTC

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.zip

Best Regards,
Haneef

Ngurah Wirawan
Replied On December 21, 2006 01:18 AM UTC

Thanks Haneef, it's working.

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

;