Delete row using delete key

Is there an easy way to delete row from the Grid grouping Control when the user hits the delete key on the keyboard after highlighting one or more rows. The current cell seems to receive the delete event even thought the entire row is highlighted. Thanks, Prem

2 Replies

AD Administrator Syncfusion Team June 15, 2006 03:39 AM UTC

Hi Prem, Try this code to delete the current record using Delete key. Please find the code snippet below. private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventArgs e) { if( Keys.Delete == e.Inner.KeyData && !e.TableControl.CurrentCell.IsEditing ) { e.TableControl.Table.CurrentRecord.Delete(); e.Inner.Handled = true; } } Let me know if this helps. Best Regards, Haneef


PR Prem June 15, 2006 05:00 PM UTC

It worked. Thanks Haneef. Prem >Hi Prem, > >Try this code to delete the current record using Delete key. Please find the code snippet below. > >private void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyEventArgs e) >{ > if( Keys.Delete == e.Inner.KeyData && !e.TableControl.CurrentCell.IsEditing ) > { > e.TableControl.Table.CurrentRecord.Delete(); > e.Inner.Handled = true; > } >} > >Let me know if this helps. >Best Regards, >Haneef

Loader.
Up arrow icon