If a grid is bound to a custom object collection (not a dataset), is there any way for a detailgrid within that grid to retrieve the object that belongs to the parent row?
I have a collection of customer objects. Each customer object has a collection of invoices: cust1 – inv1 – inv2 cust2 – inv1 – inv2 cust3 – inv1
I can bind the customer object collection to a grid and it all works fine (just by setting the grid’s DataSource property to the customer collection object).
I then want to add a detail grid which when expanded binds to the invoices collection for that customer.
When I expand cust2, for example, what’s the best way to access the invoice collection for cust2? It would be ideal if there was some way to access the ‘cust’ object directly. Or can I get the index of the collection reference and then reference the DataSource on the parent grid to get the cust object?
Imported from legacy forums. Posted by Jamie (had 2049 views)
If you want to load the detail on demand (ie. only when you expand the customer row): 1. subscribe to the DetailGrid’s CollapsedChanged event 2. set SynchronizeDetailGrids = false on the DetailGrid 3. bind to the collection in the CollapsedChanged event as follows: