Datasource in different controls

Datasource in different controls

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


vargasbo posted on Wednesday, August 09, 2006

My object is setup this way, Customer - Comments, Emails, etc.

My customer object is modified on a certain control, now my same customer object ref is passed to my comment control. The issue I'm having is that when I add a new comment and save my comment, the data in the BO is correct, comment is not marked old.

But the databinding still shows the object as new. So my question is this, when I reset the binding on my customer object in my customer control, so i have to go off and reset the binding for ever other control that has a ref to my customer object?

RockfordLhotka replied on Wednesday, August 09, 2006

The need to rebind both bindingsource controls (I assume you are doing Windows Forms) is discussed in Chapter 9. Also, there's errata around this:

http://www.lhotka.net/Cs2005Errata.aspx?id=6432c872-92ce-4bb8-bc26-b610b71956c8

(and similar errata for VB at www.lhotka.net)

vargasbo replied on Wednesday, August 09, 2006

Wow!

So I would have to rebind every single DS? my customer root goes down 6 levels. Hmm, I'll have to come up with a savvy way of doing this.

RockfordLhotka replied on Wednesday, August 09, 2006

Yeah, it is not ideal...
 
Especially given that you need to follow the model in the book (w/ errata) where you unbind first - to get the bindingsource objects back to their original state - and then rebind. On the other hand, you should be able to ONLY bind the root object, and the rest should rebind by themselves, so I guess in that light it isn't so terribly bad.
 
Rocky

 
Wow!

So I would have to rebind every single DS? my customer root goes down 6 levels. Hmm, I'll have to come up with a savvy way of doing this.

Copyright (c) Marimer LLC