DataTable -, Row deleting

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: VJ (vijaybalki_at_yahoo.com)
Date: 03/16/05


Date: Wed, 16 Mar 2005 14:00:14 -0600

I have inherited from the DataTable and have my own custom table. In this
Custom DataTable class I want to be able to cancel any row delete operation,
instead mark the row with Flag as deleted. The Table will always have Field
"FLAG" to which I can assign "DEL" saying it was deleted. How do I make sure
the row is never deleted but only marked as deleted

public class myTable : DataTable
{
        public myTable()
            {

                this.RowDeleting+=new
DataRowChangeEventHandler(InsphyDataTable_RowDeleting);

            }

              private void InsphyDataSet_RowDeleting(object sender,
DataRowChangeEventArgs e)
              {
                   //Mark row as deleted
                   e.Row["Flag"] = "DEL";
                   // How do I cancel delete here?
              }

}

Also I want to able to know the sequence.. is RowChanging fired first and
the Row Deleted... WHat is the order of below events

RowChanging
RowChanged
RowDeleteing
RowDeleted

Thanks
VJ