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
1650
Grid with UpdateMode.OnUpdate still commits changes immediately
posted

Hi there

I have a dialog with a Cancel button on it to allow the user to abort editing. The dialog contains a few standard controls and a grid. For the grid, I set the UpdateMode to UpdateMode.OnUpdate. Based on the documentation, I expected that I would have to execute a command once the dialog's OK button is clicked in order to udpate the underlying data items. However, as soon as an edited cell leaves EditMode, the update is immediately commited to the underlying DataItem.

OnUpdate: The DataSource is updated only when the DataPresenterCommands.CommitChangesToAllRecords or DataPresenterCommands.CommitChangesToActiveRecord command is executed. 


Am I missing something or doesn't this work as supposed?

Cheers

Philipp 

Parents
No Data
Reply
  • 2070
    Verified Answer
    posted

    Hi Philipp,

     

    What kind of data source are you using? 

    This feature will only work if the underlying data items implement IEditableObject interface. Essentially OnUpdate is meant to prevent the DataGrid from calling IEditableObject.EndEdit on the data items that are modified until you explicitly do so via CommitChangesToAllRecords commands. So it will only work if the underlying data items support .NET IEditableObject interface. Some of the data sources that support this interface are DataTable, DataSets, DataViews, UltraDataSource. If you have a custom data source, you can implement IEditableObject on your data objects. Essentially objects that implement IEditableObject are meant to hold original value as well as the newly modified value and only commit the new value when IEditableObject.EndEdit is called.

     

    Sandip 

     

Children
No Data