This is sort of a UI developmental question. I'm hoping to be pointed in the right direction, as I'm sure this is a common task.
For instance on the UI side, I need to bind child Csla List objects to a DetailsView. These are children of a Csla.BusinessBase that are of type Csla.BusinessListBase...
what I've been doing is making a new CslaDataSource for each one that piggybacks off the root i.e.:
e.BusinessObject = GetParentObject().SomeListObject
This seems excessive to me because for objects with several children, I end up making a TON of new CslaDataSources. What's the common approach for this? Is it necessary to do this for EVERY CslaList object? or is there an easier way?
Are you saying there these child collections are not internal to the parent object?
ozitraveller, In some situations yes, some no. Regardless, I still end up having to make a new CslaDataSource for EACH child object, which adds a lot of code to the UI to maintain. Perhaps i'm using child objects unconventionally, but I see no better option for my data...
Thanks for the reply.
I know it has been a little while since that thread was posted. I am currently dealing with a similar issue. I really am not concerned with having multiple cslaDatasource on the page. This seems to be the cases with Windows applications. My issues is that haven’t figured out is how do perform an update on the parent and all child object with a single update button.
I really don’t like the editable grid approach where you would click an edit update button on each row in the grid and also have a separate update button if you are updating the individual information.
Currently I have a Individual class which has properties for first name, mi, last name etc. It also contains two child properties for Addresses and Phone Numbers. An individual can have 0 or more addresses and 0 or more from numbers
On my Web Based form I want the user to be able to update all of this information at once. I have a asp:formView on my page which is bound to a CslaDataSource which is set to an instance of the Individual
I also have a asp:repeater control nested inside the Formview which is bound to another cslaDataSource which is set to the instance of the Individual.Addresses property.
The data displays fine and I can update any of the individual fields without any problem; however if changes are made to any of the address fields, these changes are not saved. I know it is because the clsaDatasource_Update method is never triggered for the address instance and this is because the Update is associated with the form view.
My question is how can you traverse those updates to all the child cslaDataSoruce?
Is there a better was to do this?
Thanks
I do not use the cslaDataSource control in my web app.
I have many web forms with grids and repeaters that bind just fine to CSLA business objects and collections. The unbinding code simply finds the right object in the collection using e.DataSetIndex and then determines the value in each control and sets them to the BO property. I think there is a lot of FindControl code in there too. In other words it is done "manually" I guess.
Here is a small example:
In Page Load:
If IsPostBack Then
UnbindGrid()
End If
In the code behind:
Private Sub UnbindGrid()
For Each dgi As DataGridItem In dg.Items
If dgi.ItemType = ListItemType.Item OrElse dgi.ItemType = ListItemType.AlternatingItem Then
Dim mItem As MyBO = mData.MyColl.Item(dgi.DataSetIndex)
Dim objTxt123 As TextBox = CType(dgi.FindControl("txt123"), TextBox)
Dim objChkABC As Checkbox = CType(dgi.FindControl("chkABC"), Checkbox)
mItem.123Property = objTxt123 .Text
mItem.ABC Property= objChkABC .Checked
End If
Next
End Sub
Joe
Copyright (c) Marimer LLC