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.
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