I am wondering that how to bind two grid each other like master detail represent? For example; I have two grid. Orders and Order detail. Order detail is placed next of the Orders. I want to make a dynamic filter that can make rows hide or visible in detail table grid according to my selection.. This actions can be triggered by row select or row double click event. It does not matter. I hope, I could tell properly. Thanks in advance.
Asked
Active
Viewed 5,943 times
1 Answers
2
If you are using an ADO.NET dataset (System.Data.DataSet
), the GridControl instance intended for displaying the detail data should be bound to an ADO.NET data relation.
Below is code snippet for binding of the standard NorthWind dataset in the two-grid master-detail manner:
BindingSource masterBS = new BindingSource();
masterBS.DataMember = "Orders";
masterBS.DataSource = nwindDataSet1;
BindingSource detailBS = new BindingSource();
detailBS.DataMember = "OrdersOrder Details";
detailBS.DataSource = masterBS;
this.gridControl1.DataSource = masterBS;
this.gridControl1.ShowOnlyPredefinedDetails = true; //
this.gridControl2.DataSource = detailBS;
To see the complete code review the following DevExpress KB-article: How to Display Master-Detail Tables in Separate Grid Controls
-
2EugenePodskal and 2arun - the link above refers to the DevExpress Knowledge-Base article that provides all needed details and contains the exact answer from the official source. So, i does not understand your down-voting... Anyway, I've updated my answer a bit. – DmitryG Aug 12 '14 at 13:00