Robert,
Thanks for the reply, and for your netTiers work too.
I have the child binding source configured as you suggest - bsChild.DataSource = bsParent, and bsChild.DataMember = "ParentPropertyReturningChildList". Since the original post, I found this article on Code Project that shows how to use parent/child DataGridViews with business objects.
I followed that approach, which creates a DataSource from the Orders entity, dragged Orders to the parent grid, and OrderDetailsCollection to the child grid, and the ide created the binding sources and the columns in the grids. When I load the TList and assign the datasource/datamember to the bindingsources, the parent grid shows cell values as expected, but the child grid shows the correct number of rows for the selected parent, but all the child cells are blank. In order to get the child grid to display values, I had to handle CellFormatting, basically extracting the underlying values from the child bindingsource and assigning the cell value.
private void dgOrderDetails_CellFormatting(object sender,DataGridViewCellFormattingEventArgs e) {
if (e.RowIndex < this.orderDetailsCollectionBindingSource.Count) {
OrderDetails od = (OrderDetails)this.orderDetailsCollectionBindingSource[e.RowIndex];
if (od != null) {
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(od);
PropertyDescriptor desc = props.Find(this.dgOrderDetails.Columns[e.ColumnIndex].DataPropertyName,true);
e.Value = desc.GetValue(od);
}
}
}
It seems like I'm missing something real basic here. If anyone has a working example of binding a deeploaded entity to a pair of parent/child DataGridViews, I'd appreciate taking a look at it.
Thanks again.