B
Bob Johnson
..NET 3.5, Windows Forms app: My objective is to display parent/child data in
two ComboBox controls, such that when a parent item is selected in one combo
box, associated child items appear in the other combo box.
I already know one way to make this work using two DataTables and a
DataView, and handling the SelectionChangeCommitted event of the parent
ComboBox so that it sets the .RowFilter of the DataView to which the child
ComboBox is bound.
But what I am wondering is if there is a simpler way to get the job done
using a DataSet with the two DataTables and a DataRelation to set up the
parent/child relationship. I have set up a DataSet as described, but the
child ComboBox (which is bound to the child DataTable in the
DataSet)displays *all* rows from the child DataTable, completely ignoring
the DataRelation, when I am wanting for it to display only the child rows
related to the currently selected parent DataRow.
Am I just missing something, or do I really need to go with the DataView
approach?
Thanks!
two ComboBox controls, such that when a parent item is selected in one combo
box, associated child items appear in the other combo box.
I already know one way to make this work using two DataTables and a
DataView, and handling the SelectionChangeCommitted event of the parent
ComboBox so that it sets the .RowFilter of the DataView to which the child
ComboBox is bound.
But what I am wondering is if there is a simpler way to get the job done
using a DataSet with the two DataTables and a DataRelation to set up the
parent/child relationship. I have set up a DataSet as described, but the
child ComboBox (which is bound to the child DataTable in the
DataSet)displays *all* rows from the child DataTable, completely ignoring
the DataRelation, when I am wanting for it to display only the child rows
related to the currently selected parent DataRow.
Am I just missing something, or do I really need to go with the DataView
approach?
Thanks!