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

Deleting rows in GridControl

Hi, I want to be able to delete the selected rows in a GridControl when user clicks on DELETE key. The default action of the grid is to clear the rows (and keep empty rows instead). Instead of having empty rows, I would like to be able to delete the rows so that I would not have "gaps" of empty rows between the rows of my grid. I tried to catch the following events : gridControl.RowsRemoving gridControl.RowsRemoved But the DELETE key does not seem to trigger any of theese events... Thanks Ams

2 Replies

Administrator February 28, 2005 05:12 PM UTC

Try handling the ClearingCells event. private void grid_ClearingCells(object sender, GridClearingCellsEventArgs e) { GridRangeInfo range = e.RangeList.ActiveRange; if(range.IsRows) { this..Rows.RemoveRange(range.Top, range.Bottom); e.Handled = true; } }

LA Lamy March 1, 2005 09:48 AM UTC

Great ! Thank you. >Try handling the ClearingCells event. > >private void grid_ClearingCells(object sender, GridClearingCellsEventArgs e) >{ > GridRangeInfo range = e.RangeList.ActiveRange; > if(range.IsRows) > { > this..Rows.RemoveRange(range.Top, range.Bottom); > e.Handled = true; > } >}
Loader.
Live Chat Icon For mobile
Up arrow icon