Description:
How to display master-detail tables in two different grids? A master table should be displayed in one GridControl. Another GridControl should contain details for the selected master row in the first grid.
Answer:
The most popular way to visualize Master-Detail tables in an XtraGrid is by displaying the detail data embedded into master rows that then expand to show the detail view. However, sometimes it may be desirable to display the detail data in a Grid control of it's own, and as you navigate through the master data in a master grid the detail data in the detail grid displays all the related detail controls for the selected master record.
It is easy to implement this, if you are using an ADO.NET dataset (System.Data.DataSet). The GridControl object intended for displaying the detail data should be bound to an ADO.NET data relation. Please look at the attached sample. The DataMember property of GridControl2 is the name of a data relation for the Customers table, which is assigned to the DataSource property.
Visual Basic' Bind to a relation
GridControl2.DataSource = DataSet11.Customers
GridControl2.DataMember = "CustomersOrders"
If you are using a third-party data object or you have built your own, and it can contain master-detail data like System.Data.DataSet then you will probably be able to bind it's detail data to an XtraGrid as shown above.
See Also:
How to use two XtraGrid controls to display collections of persistent objects with a one-to-many association
Do you have any solution for the same scenario with ViewModel binding in WPF Xpf.GridControl ?
Hi,
I have extracted your inquiry to a separate ticket and passed it to our WPF team. Please refer to the Q375292 thread.