Home Forums WinForms controls Xceed Grid for WinForms Hi Regarding masterdetail grid

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #14752 |

    Hi i tried to work with the master detail grid
    here is the code i have written but giving some error can any one help me.
    Dim con As New SqlConnection(constr)
    Dim cmd As New SqlDataAdapter(“Select * from properties”, con)
    ‘ Mortgagekey is primary in the above table
    Dim cmd1 As New SqlDataAdapter(“select * from Mortgages”, con)
    cmd.Fill(ds, “tbl1”)
    cmd1.Fill(ds, “tbl2”)
    Dim colPrimaryKey(1) As DataColumn
    colPrimaryKey(0) = ds.Tables(0).Columns(“MortgageKey”)
    ds.Tables(0).PrimaryKey = colPrimaryKey
    Dim dataRelate As New DataRelation(“hello”, ds.Tables(0).Columns(“MortgageKey”), ds.Tables(1).Columns(“MortgageKey”))

    Dim grid As New GridControl()
    grid.BeginInit() ‘ EndInit will be called later
    grid.DataSource = ds.Tables(0)

    grid.Dock = DockStyle.Fill
    grid.FixedHeaderRows.Add(New GroupByRow())
    grid.FixedHeaderRows.Add(New ColumnManagerRow())
    Dim detail As New DetailGrid()
    detail.HeaderRows.Add(New ColumnManagerRow())
    ‘detail.DataSource = ds
    ‘detail.DataMember = “tbl2.hello”
    detail.SetDataBinding(ds, “tbl1.hello”)

    it is giving the error like this
    The Column tbl1.hello does not exist in the parent grid.

    Please any one help me
    Thanks in Advance

    Imported from legacy forums. Posted by Naresh (had 2120 views)

    User (Old forums)
    Post count: 23064

    You need to set the DataSource of both the Grid and DetailGrid to the same, and set the DataMember of the DetailGrid to the relationship.

    e.g. :

    grid.DataSource = dsTables(0)

    detail.DataSource = ds.Tables(0)
    detail.DataMember = “hello” ‘or whatever the name of the relationship

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.