asp.net.ph

DataRowView.CancelEdit Method

System.Data Namespace   DataRowView Class


Cancels an edit procedure.

[ VB ]
NotOverridable Public Sub CancelEdit ( )

[ C# ]
public void CancelEdit ( );

[ C++ ]
public: __sealed void CancelEdit ( );

[ JScript ]
public function CancelEdit ( );

Remarks

After calling CancelEdit, all changes to the row are rolled back. You can also roll back changes by calling RejectChanges on the parent DataTable.

Example

The following example edits a row in a DataView. The CancelEdit method is called to cancel the changes if the validation fails.

private void EditDataRowView ( DataRowView drv, string colToEdit ) {
   drv.BeginEdit ( );
   drv [ colToEdit ] = textBox1.Text;
   // validate the input with a function.
   if ( ValidateCompanyName ( drv [ colToEdit ] ) )
      drv.EndEdit ( );
   else
      drv.CancelEdit ( );

}

private bool ValidateCompanyName ( object valuetoCheck ) {
   // insert code to validate the value.
   return true;
}
  C# VB

See Also

DataRowView Members   AcceptChanges   AllowDelete   AllowEdit   AllowNew   BeginEdit   DataRow   EndEdit   RowVersion Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph