Attention: We are retiring the ASP.NET Community Blogs. Learn more >

CancelCurrentEdit docs are a little misleading

I am seeing cases in our app where calls to CancelCurrentEdit are not Rejecting changes made by the user. I have to manually call RejectChanges on the datasource after calling CancelCurrentEdit. I assumed the call to CancelCurrentEdit would RejectChanges made to the datasource; at least that is what the docs state:

"The following example demonstrates both the CancelCurrentEdit and the EndCurrentEdit methods. When you call the CancelCurrentEdit method, changes made to the data are rejected"

The 'rejected' text is a bit misleading.  It actually works like this:

"After invoking BeginEdit on a DataRow, any edited value becomes the Proposed value. Until either CancelEdit or EndEdit is invoked, the row has an Original and a Proposed version. If CancelEdit is invoked, the proposed version is discarded, and the value reverts to the original. If EndEdit is invoked, the DataRowView no longer has a Proposed version; instead, the proposed value becomes the current value. Default values are available only on rows that have columns with default values defined."

MS has entered a bug asking that this text should be cleaned up to remove the confusion

No Comments