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

Delete of contents in a GridControl

Hi,

I'm using GridControl object to display some data in a form. But when a row or column header is selected and delete key is pressed, all the data in the selection gets removed. I tried to set some property values and override the keypress event for the current cell. But, I could not stop this from occuring.

Is there anyway i can block the delete operation?

Thanks,
Priya

3 Replies

JJ Jisha Joy Syncfusion Team August 18, 2009 10:27 AM UTC

Hi Priya,

The desired behavior can be achieved by handling the KeyDown event of GridControl. See the code:
void gridControl1_KeyDown(object sender, KeyEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
if (cc.ColIndex == 0 || cc.RowIndex == 0)// Checking for row/column header
{
if (e.KeyCode == Keys.Delete)
{
e.Handled = true;
}
}
}

Thank you for using Syncfusion products.

Regards,
Jisha


PS Priya S August 18, 2009 02:12 PM UTC

Hi,

Thanks a lot. That helped.

I was trying with the current cell key down event and tried to return if the key value was delete. But that never worked.

Thanks again.


ER Edward Reyes February 28, 2013 06:29 PM UTC

We have AllowDelete set to false, AllowMultipleRecordDeletion set to false, AllowSelection set to False and with a LeftShift Key and a Delete Key pressed in combination, the Selected row is still being deleted.  How can all deletions be disabled?  Is this yet another Syncfusion bug that has to get fixed?
 
Ed

Loader.
Live Chat Icon For mobile
Up arrow icon