Home All Groups Group Topic Archive Search About

Deleting row from DataView

Author
9 Nov 2005 8:42 PM
Derrick
Hello;

Dealing with Winforms on 1.1 framework, VS.NET 2003.

I have a DataView (which is the datasource for a datagrid), and I want to be
able to delete rows only if specific columns contain specific values.  For
instance, one of the columns contains boolean values; if the value for the
row in question is true go ahead and delete it, but if it's false cancel the
delete.

I have a handler hooked to the DataTable.RowDeleting event (the DataTable is
obviously the source for my DataView), which supposedly fires before the row
is deleted.  In there, I check my column conditions, but what I need to know
is what do I call to cancel the deletion?  I've tried DataRow.RejectChanges,
DataRow.CancelEdit, and DataTable.RejectChanges to no avail - the row always
disappears from the datagrid, so I assume the row is being deleted from the
view.  I step through the event, so it is being triggered and my condition
checking is accurate.

Thanks for your help;

Derrick

AddThis Social Bookmark Button