Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to view persistent objects in the XtraGrid and edit them in a separate window

$
0
0

Scenario
This example demonstrates how to view persistent objects in the XtraGrid and edit them in a separate window in the scope of UnitOfWork , so that changes made to the object's properties can be saved or canceled. This approach helps implement a comfortable UI for data input. 

Steps to implement:
1. 
Add GridControl to a Form and use XPCollection as a DataSource as described in the Tutorial 4 - A Windows Forms Application for Data Editing article.
2. Add BarManager with 3 BarButtonItems and handle the Click event as shown in the FormViewOrders.xx file. These buttons will be responsible for creation, modification and removing persistent objects. 
3. Add a second Form that will be used for persistent object modifications. This form will use the UnitOfWork class to work with the passed persistent object. Unit of Work keeps tracking every change to every persistent object during transaction that can affect a data store. With a single call of the UnitOfWork.CommitChanges method, all the changes made to the persistent objects are automatically saved to a data store.  For implementation details, see FormEditOrder.

 

See Also:
Unit of Work 
XPO Best Practices
Connecting to a Data Store
%Public%\Documents\DevExpress Demos 14.1\Components\WinForms\CS\ContactManagement\


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>