Is there a way to bind a grid to multiple business objects?
I have a parent class that has a one to one relationship with it's child. Currently I have 2 grids(one per class bound) but would like to have one grid with a coupla bands.
ParentClass has many fields but 3 fields I need readonly to display in the ChildClassGrid so it would look like
ParentGrid
ParentClassField1 ParentClassField2 ParentClassField3 ParentClassField4
For each Row in the ParentClass The ChildGrid would be
ReadOnlyParentClassField1 ReadOnlyParentClassField2 ReadOnlyParentClassField3 ChildClassField1 ChildClassField2
ParentClass & ChildClass are bound to different BusinessObjects Binding
I currently have three unbound columns in the ChildGrid but am unsure how to fill the columns
in the initRow I do
e.Row.Cells("ReadOnlyParentClassField1").Value = "ReadOnlyParentClassField1" but am unsure how to link them to its parents values
Regards
_Eric
Eric,
We do this quite a lot for displaying data. What we do is create a 'hierarchical' parent which derives from your parent object to which we add an additonal bindinglist containing the child objects. We then create a returm this 'hierachical parent as a binding list and set this to the datasouirce of the grid. The data should then be displayed hieararchically. We've done this down to about 6 levels of 'nesting' so far andworks far better than having multiple grids.
Jim