Home Forums WinForms controls Xceed Grid for WinForms Master Detail and Relationship Reply To: Master Detail and Relationship

User (Old forums)
Member
Post count: 23064

The problem is the way you bind the grid and the detail grid.  If I take the second snippet you use, your DataSet and the relationship are properly set up.  What you need to do is change this :

            GridControl1.SetDataBinding(ds.Tables(0), “”)
            Dim detail As New DetailGrid
            detail.SetDataBinding(ds.Tables(1), “”) 

for this :

            GridControl1.SetDataBinding(ds.Tables(0), “”)
            Dim detail As New DetailGrid
            detail.SetDataBinding(ds.Tables(0), “Mater_Child”)

As you can see, the DataSource on which both the master and the detail grids are bound must be the same.  What changes is the DataMember, in which you need to specify the relationship for the detail grid, and nothing for the master grid.

In you first scenario, it will not work since there is no relationship, but if you were to add relationships, you would need to do the same, that is, bind the detail grid to the same DataSource of the master grid (which would be dsRemote(0)), and specify the relationship name for the DataMember of each detail grid.

Imported from legacy forums. Posted by André (had 427 views)