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

How to copy last entered values into a newly created object, when using the Save and New action

$
0
0

This example covers a situation when an end-user fills DetailView information in batch mode. Sometimes it's necessary to duplicate last entered items into a new DetailView form.
For implementation details, please refer to the platform-independent NewValuesController class (see the NewObjectInit.Module project).
Basically, the current object is saved when the Save and New action is executed. After a new DetailView is initialized, the new object is updated using the previous object details.

Question Comments

Added By: Khaled Abdo at: 1/7/2013 5:31:25 PM    

Exception when object has Lookup object.
--------------
Exception occurs while assigning the 'DetailView, ID:Person_DetailView' view to WinWindow:
The 'DevExpress.Persistent.BaseImpl.Address' object belongs to a different session.

Added By: Khaled Abdo at: 1/7/2013 6:06:12 PM    

Hello,

I already found the solution.
........modify code to be like below........
                Person current = (Person)View.CurrentObject;
                Address addressObjectByKey = current.Session.GetObjectByKey<Address>(person.Address1.Oid); ;
                current.Address1 = addressObjectByKey;
                current.FirstName = person.FirstName;
........
DevExpress are the best ^_^

Added By: Apostolis Bekiaris (DevExpress) at: 7/30/2013 2:54:51 AM    

You can find a variant of this implementation configurable from application model in www.expandframework.com v13.1.5.16 and later. (see also http://goo.gl/694UOG)


Viewing all articles
Browse latest Browse all 7205

Trending Articles



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