Stécy
Stécy

Reputation: 12349

How to do a read on a details table from a selected master record?

I have a binding source on a dataset with two tables, a master containing lots of records and a details where I would only have the details from the selected master record.

Changing the position of the current record in the master table should trigger a request to replace the data in the details table with the new details.

However, I am not sure on how to proceed with this plan.

Should I monitor the selection of the record in the master table, get the details data for the corresponding master record and replace all data in the details table?

Upvotes: 1

Views: 89

Answers (1)

Will
Will

Reputation: 895

Set the SelectionMode on the master table to RowSelect, then handle the SelectionChanged event. Within that event, simply clear the BindingList of detail objects which are bound to the detail table, and re-populate the detail list with the new detail items based on which master item is selected.

Upvotes: 1

Related Questions