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

How to delete a record from data grid

Hi Every one, i wanted to delete a record from grid when i press a specific key like DELETE , I have initialized KeyDown Event of grid but when i click any key it doesn,t fire the event , How Can i Do This, Thanks.

Regards,

Mgs4solidsnake

1 Reply

AD Administrator Syncfusion Team December 18, 2006 08:35 AM UTC

Hi Mgs4solidsnake,

You can achieve the intended behavior by handling the TableControlCurrentCellKeyDown event. This event will be triggered for key down in the cell.

The reason for the grid’s KeyDown event is not being triggered because the key down ( Delete, Shift etc ) has been handled by current cell.

>>>>>>>>>>>>>>>
//this.gridGroupingControl1.TableControlCurrentCellKeyDown += new GridTableControlKeyEventHandler(gridGroupingControl1_TableControlCurrentCellKeyDown);
private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if(e.Inner.KeyCode == Keys.Delete)
{
this.gridGroupingControl1.Table.CurrentRecord.Delete();
e.Inner.Handled = true;
}
}
>>>>>>>>>>>>>>>

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon