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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting a range of cells

Thread ID:





60036 Apr 26,2007 03:54 PM UTC May 2,2012 09:25 AM UTC WinForms 3
Tags: GridControl
Kyle DeVoe
Asked On April 26, 2007 03:54 PM UTC

We are using a cell activation of Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;

With the behaviour, when you enter a cell, it starts editing immediately.

When the user selects a range of cells and deletes, it currently only deletes the contents of the CurrentCell (the one in edit mode). I've tried calling CurrentCell.EndEditing() before the delete is processed, but that did not fix it.

I would like the deletion of a range to work the way it does when Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.None;

Thank you,

haneefm [Syncfusion]
Replied On April 26, 2007 05:46 PM UTC

Hi Kyle,

One way you can do this by handling the CurrentCellKeyDown event of the grid and call the ClearCells method to delete the content from the selected cells in a grid. Here is a code snippet.

private void grid_CurrentCellKeyDown(object sender, KeyEventArgs e)
if(e.KeyData == Keys.Delete)

Best regards,

Fabio Cavalcante
Replied On April 11, 2012 10:13 PM UTC

And how can i move the left over content to the deleted cell?


Having A1, A2, A3. If i remove A2, A3 should be placed at A2.


Mercy C [Syncfusion]
Replied On May 2, 2012 09:25 AM UTC

Hi Fabio,

Thanks for update.

To move the left over cell contents, please make use of "Rows.RemoveRange()" method to remove the empty space.

void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
if (e.KeyData == Keys.Delete)
this.gridControl1.Model.ClearCells(this.gridControl1.Model.SelectedRanges, false);
this.gridControl1.Rows.RemoveRange(this.gridControl1.Model.SelectedRanges.ActiveRange.Top, this.gridControl1.Model.SelectedRanges.ActiveRange.Bottom);

Please refer to the sample in the following link



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon