Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
340
Cancel XamDataGrid Edits
posted

What's the recommended approach for cancelling edits made to existing and new rows in a XamDataGrid?  My XamDataGrid is bound to a DataView.  In the code below the SelectedTab.Records is a DataView.

This is the code I have that seems to work for existing rows, but not for changes made to the add row.

foreach (DataRowView view in SelectedTab.Records)
{

if(view.IsEdit)
{
view.Row.RejectChanges();
view.Row.AcceptChanges();
view.Row.BeginEdit();
}
view.BeginEdit();
}

When called on the add row I get the following exception -

An exception of type 'System.Data.RowNotInTableException' occurred in NCS.MIDP.exe but was not handled in user code

Additional information: This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row.