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 one or multiple rows in a DataBoundGrid

Attached is a simple example I have created to test the deletion of one or multiples rows. I have seen some of the examples provided in this forum, but for some reason, it is not working as I expect. Basically after I select multiple rows the gridDataBoundGrid.Selections.Ranges.ActiveRange property is not returning any selection. Also I'm not able to cancel the Handler if the selection can not be deleted. What am i doing wrong? Thanks in advance. Jose.

3 Replies

AD Administrator Syncfusion Team July 3, 2003 09:17 PM UTC

The default behavior of the grid is to delete rows if you select a row range, and press the delete key. In your code, what is happening is that the rows have already been deleted by the time your RemoveRows() method is called, so the selected range has been removed. Hence, the range you get is empty. You can see this by commenting out your CurrentCellKeyDown code, so your RemoveRows is never called, but the selected rows will be removed anyway.

JM Jose M. Gonzalez July 7, 2003 03:54 PM UTC

Oooooopppsss! Got it. What do you recommend if I need to show a confirmation message before the user deletes one or more rows? Thanks

AD Administrator Syncfusion Team July 7, 2003 04:33 PM UTC

You can use the RowsDeleting event. It is cancelable.

Live Chat Icon For mobile
Up arrow icon