ReadOnlyChildList binding to ComboBox

ReadOnlyChildList binding to ComboBox

Old forum URL:

tlyle posted on Monday, October 26, 2009

I am having trouble implemnting databinding to ReadOnlyChildList to a ComboBox.  For example I have the following:

CompanyList - ReadOnlyList
-->CompanyListItem - ReadOnlyChild
---->DivisionList - ReadOnlyChildList
------>DivisionListItem - ReadOnlyChild
--------->DepartmentList - ReadOnlyChildList
------------>DepartmentListItem - ReadOnlyChild

I have an Editible Root called Emploee which is assigned a Company, Division, and Department.

I have a WinForm that is bound to the Employee object.  This form contains three dropdown boxes Company, Division, and Department.

The Company ComboBox is bound to the CompanyList, and the datasource is set during the FormLoad event.

The DivisionList is bound to the DivisionList property of the CompanyListBidingSource, and Department is bound to the DepartmentList property of the DivisionListBindingSource.

When the form is opened with the Employee object and the Company combobox contins the company list and the corroect value is selected. However, while the Division comobox is populated with the appropriate values for the selected company, the correct division is not selected.  The first item in the list is selected.  The same is also true for the Deparment list.

I know the databinding is working, and the objects are loading properly from the database, and if I make changes to the selected values they are saved to the database.

I just cant figure out how to make the correct Select Value disply on the two child combo boxes.  Thanks for any guidance you can give.


Copyright (c) Marimer LLC