How to cancel deleting a row in an event

  • Thread starter Thread starter Hamed
  • Start date Start date
H

Hamed

Hello

I need an event to be able to cancel a delete request to a DataRow object in
some conditions. It seems DataRowDeleting should be able to do the job but
setting e.Action is impossible (it is read-only)

How can I do the above job?

Thanks in advance
Hamed
 
I need an event to cancel deletion of a DataGrid row that the DataTable is
bound to.
 
I think that the only way is to throw an exception.
An ugly way btw.
 
Thanks Cor but in the code you mentioned if a cell is selected but the whole
row is not selected, it will be deleted that is not a desired occurrence.

any other suggestion is appreciated

Hamed
 
Honestly, I give up on controlling/cancelling row deletion. Instead I don't
allow deletion before it happens..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top