System.Data.DataRow.BeginEdit Method

Starts an edit operation on a System.Data.DataRow object.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
public void BeginEdit ()

Remarks

Use the DataRow.BeginEdit method to put a System.Data.DataRow into edit mode. In this mode, events are temporarily suspended, letting the user make changes to more than one row without triggering validation rules. For example, if you must make sure that the value of the column for a total amount is equal to the values for the debit and credit columns in a row, you can put each row into edit mode to suspend the validation of the row values until the user tries to commit the values.

The DataRow.BeginEdit method is called implicitly when the user changes the value of a data-bound control; the DataRow.EndEdit method is called implicitly when you invoke the DataTable.AcceptChanges method for the System.Data.DataTable object. While in this edit mode, the System.Data.DataRow stores representations of the original and new proposed values. Therefore, as long as the DataRow.EndEdit method has not been called, you can retrieve either the original or proposed version by passing either DataRowVersion.Original or DataRowVersion.Proposed for the version parameter of the DataRow.Item(int) property. You can also cancel any edits at this point by invoking the DataRow.CancelEdit method.

To see if the row contains an original or proposed value, call the DataRow.HasVersion(DataRowVersion) method.

Note:

The DataRow.BeginEdit method temporarily suspends DataTable.RowChanging events, but the delete operation does not.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0