(master/detail) Collection and entity binding

Posts   
 
    
llblPowa
User
Posts: 41
Joined: 19-Nov-2006
# Posted on: 18-Jun-2007 23:42:23   

Hello All,

I am having a gridview (Winform) bind to a collection of book. when I double click on a book, the a detail form appears.

When I do change in the detail, the collection is automatically updated in the gridview.

Ok, so this is a normal behavior as the change has been performed in-memory.

--> However, in the detail form, informations could be changed or not by the user.

If the user changes the information then close the form, then I will ask him if he wants to save the information or not.

whether the user saves the information or not, the gridview is always updated?

How can I avoid that? I just want the grid to be updated if the user save the detail form.

Cheers,

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Jun-2007 04:48:53   

Hi. Could you post the way you are establishing communication between the Grid and the details form? Also, What LLBLGen version are you using and what templateSet (adapter or SS)? Have you tried with CancelEdit?

David Elizondo | LLBLGen Support Team
llblPowa
User
Posts: 41
Joined: 19-Nov-2006
# Posted on: 19-Jun-2007 10:08:09   

I am using v2 / Adapter.

my gridview is bind to a Collection. When I double click, then I am calling the detail form passing the entity as a parameter. There is not fetch again.

Chat do you mean with cancelEdit?

++

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 19-Jun-2007 10:44:25   

Better to use the Entity.SaveFields() & Entity.RollbackFields() methods of the entity.

Call SaveFields(/Some name/), when you open the details form, and if the user choose to not save the changes then you should call Rollbackfields(/Some name/).

Please refer to the LLBLGen Pro reference manual for those methods. Also check Field data versioning, in the LLBLGen Pro manual, under "Using the generated code -> SelfServicing/Adapter -> Unit of work and field data versioning"

llblPowa
User
Posts: 41
Joined: 19-Nov-2006
# Posted on: 19-Jun-2007 11:03:33   

Exactly what I was looking for :-) Thanks.