Hooking Up The Page

Hooking Up The Page

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


Wbmstrmjb posted on Tuesday, February 10, 2009

C#, ASP.NET and CSLA 3.0

We have a scenario where we have a root BO with multiple editable children that affect one another.  For instance, let's call our root object Parent and our editable children lists Sons and Daughters of editable objects Son and Daughter respectively.  Let's say that the business logic is that each child knows how many siblings they have (in our model, it's quite a bit more complex, this is just an example).  So editing Sons would mean that each Daughter objects gets their "SiblingCount" property updated.  Anyway, this is all one webpage with each child list (Sons, Daughters) on two different tabs below some Parent information up top.

Now the question is, how do we bind this all?  I think we need to keep the Parent/Child relationship in the BOs because of the business logic associated, but how do we bind the Parent info and the Sons info and the Daughters info to ecah of their repsective tabs?  Do we have 3 seperate DataSources or one DataSource?  Do we need to split the BOs into seperate root objects and then somehow notify the other BOs when there is a change?

Thanks,

Mike

SonOfPirate replied on Tuesday, February 10, 2009

It sounds like you can get away with simply having three DataSources on your page, one corresponding to each control you are binding to.  The first would use Parent as its source with the other two using Parent.Sons and Parent.Daughters, respectively.

You will need to work out the necessary logic to ensure that Parent exists before binding to the children, of course, which can probably be handled most easily by creating a property that your three handlers call to get a valid reference to Parent.  That way it won't matter what order the controls are bound.

Hope that helps.

 

Copyright (c) Marimer LLC