Home Forums WinForms controls Xceed Grid for WinForms Master Details Problem

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

    //Master Table with Primary key “ProductId”
    dtGridTable.TableName = “StockRotationAlg”
    //Child Table with Primary key “ProductId, TxnType”
    dtChildGridTable.TableName = “ChildTable”
    //dataset name srDataset
    srDataSet.Tables.Add(dtGridTable)
    srDataSet.Tables.Add(dtChildGridTable)

    ParentColumn = dtGridTable.Columns(“ProductId”)
    ChildColumn = dtChildGridTable.Columns(“ProductId”)

    //Foreign key Constraint
    FKC = New ForeignKeyConstraint(“StockRotationAlgFKC”, ParentColumn, ChildColumn)
    dtChildGridTable.Constraints.Add(FKC)
    FKC.DeleteRule = Rule.Cascade
    FKC.UpdateRule = Rule.Cascade
    FKC.AcceptRejectRule = AcceptRejectRule.None

    //Data relation
    dataRelation = New dataRelation(“StockRotationAlgFKC”, ParentColumn, ChildColumn, False)
    srDataSet.Relations.Add(dataRelation)

    //
    //IMP. With the above code I can able to bind to datagrid(Microsoft default grid).
    // I am able to create relation and I can able to see the child table link.
    //

    //And I am binding the dataset to both master and child as

    dgStockRotation.DataSource = srDataSet
    dgStockRotation.DataMember = “StockRotationAlg”

    dgChildTable.DataSource = srDataSet
    dgChildTable.DataMember = “StockRotationAlg.StockRotationAlgFKC”

    // Now I can able to see only parent (Master) table. Child table is shown as blank.
    // I found the same code with your example.
    // If any thing wrong or modification please inform to me.

    Imported from legacy forums. Posted by Sivaram (had 1944 views)

    User (Old forums)
    Member
    Post count: 23064

    I got the solution with a small change in the last row.

    Finally I updates the master grid.

    and my problem solved.

    Imported from legacy forums. Posted by Sivaram (had 2937 views)

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