We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Master-Detail doesn''t work with DockingManager. Pls help

I''m trying to design a master-detail form by adding two GDBGs. The following codes from users guide will work well. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ´fill the dataset with the two tables Me.SqlDataAdapter1.Fill(Me.DataSet11.Customers) Me.SqlDataAdapter2.Fill(Me.DataSet11.Orders) ´add a DataRelation to the dataset Dim dr As DataRelation = New DataRelation("CustomersToOrders", Me.DataSet11.Customers.Columns("CustomerID"), Me.DataSet11.Orders.Columns("CustomerID")) Me.DataSet11.Relations.Add(dr) ´set up the datasources Me.masterGrid.DataSource = Me.DataSet11.Tables("Customers") Me.detailsGrid.DataSource = Me.DataSet11.Tables("Customers") Me.detailsGrid.DataMember = "CustomersToOrders" End Sub However, after I add a dockingManager and enable masterGrid to be dockable, the detailGrid never respond to the row changes in the masterGrid any more.

2 Replies

AD Administrator Syncfusion Team February 17, 2005 09:31 AM UTC

In order for the master-details to work, both grid''s need to be using the same binding context. Normally, the grid takes its binding context from its parent. Try handling the DockedStateChanged event and force the two grids to have teh same BindingContext.
private void dockingManager1_DockStateChanged(object sender, DockStateChangeEventArgs arg)
{
	if(this.gridDataBoundGrid1.BindingContext == null)
		this.gridDataBoundGrid1.BindingContext = new BindingContext();
	this.gridDataBoundGrid2.BindingContext = this.gridDataBoundGrid1.BindingContext;
}


FL Frank Lin February 18, 2005 07:03 AM UTC

It works. Thanks Clay.

Loader.
Live Chat Icon For mobile
Up arrow icon