delete row by key on a grid

Hi there,

I have a grid on a form very simple, and by selecting a row and pressing the delete key the row get's deleted.

I didnt do anything to get this behaviour !!!
How can i disable the delete of a row by pressing the delete key, or if that isn't possible disable all keys on the grid ?

Thanks
0L

3 Replies

AD Administrator Syncfusion Team November 14, 2006 09:22 AM UTC

Hi OL,

Issue 1: For GridControl DeleteKey.

To disable the DeleteKeyBehavior in a grid, you can handle the CurrentCellKeyDown and set the e.Handled to TRUE. Here is a code snippet

private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if( e.KeyCode == Keys.Delete )
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if(!cc.IsEditing )
e.Handled = true;
}
}

Issue 2: DataBound DeleteKey

Try setting the EnableRemove property of the grid to FALSE. Below is a code snippet.

this.grid.EnableRemove = false.

Best Regards,
Haneef


OL Omry Levy November 14, 2006 04:43 PM UTC

Thanks worked like a charm.

Could you consider adding the following:

1) a delete permission on the grid as a whole

2) keyboard disable on the grid as a whole




JJ Jisha Joy Syncfusion Team January 12, 2009 06:15 AM UTC

Hi Julie,

Please use the following link for the forum thread that dicusses the same issue.

http://www.syncfusion.com/support/forums/message.aspx?MessageID=51775

Regards,
Jisha


Loader.
Up arrow icon