EditLevel Mismatch with grandchild (winform)

EditLevel Mismatch with grandchild (winform)

Old forum URL: forums.lhotka.net/forums/t/12163.aspx


g.beraudo@castsoftware.com posted on Thursday, September 26, 2013

Dear all,

I might get too far from what I used to do with winform binding.

I have a root object, with a child collection and grandchild collection, lets call it:

Invoice [contains editable fields & computed fields]

+ InvoiceItemCategoryCollection [bound to my grid]

++ InvoiceItemCategoryItem [contains computed fields only]

+++ InvoiceItemCollection

++++ InvoiceItemItem [really contains editable fields]

 

I'm binding the above graph, using 2 bindsources.

bsInvoice: for the root object (Invoice), used to bind textBoxes & co

bsItemCategories: used to bind a grid with 2 levels of bands [it is an Infragistics grid, but I do not think this has an impact there]

Before unbinding my controls, my objects graph looks like:

Invoice [2]

+ InvoiceItemCategoryCollection [1]

++ InvoiceItemCategoryItem [2]

+++ InvoiceItemCollection  [1]

++++ InvoiceItemItem  [2]   => Problem there, how do I apply / cancel edit at that leve?

++++ InvoiceItemItem  [1]

++ InvoiceItemCategoryItem [1]

+++ InvoiceItemCollection  [1]

++++ InvoiceItemItem  [1]

which seems correct. The first row of each band is 'selected' and thus in edit model.

Do you have any best practice for unbinding the grand child?

 

I'm currently facing EditLevel mismatch exception since I do not know how to manage this use case properly.

I'm not currently using CslaContrib_BindingSourceExtensions, but I read the books and applied the same spirit kind of extension, without facing this use case until our current improvement.

Thanks for your help / feedback,

Regards,

Gilles

 

Copyright (c) Marimer LLC