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

Best way to delete a row from a Grid (Unbound)

I want to be able to remove a row from the grid by selecting it and pressing the delete the key. Currently the behaviour is to make the cells in the row blank. What is the best way to do this? Should I capture the Delete KeyPress?

1 Reply

AD Administrator Syncfusion Team February 20, 2005 12:15 PM UTC

One way you can do this is to handle the ClearingCells event and remove the row there.
private void gridControl1_ClearingCells(object sender, GridClearingCellsEventArgs e)
{
	GridRangeInfo range = e.RangeList.ActiveRange;
	if(range.IsRows)
	{
		this.gridControl1.Rows.RemoveRange(range.Top, range.Bottom);
		e.Handled = true;
		e.Result = true;
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon