mysqlwinformsxtragrid

Master Detail view in xtragrid devexpress


I have a WinForm solution in c# and .NET4. I use Mysql and ListDataSource for fill data in xtragrid. I would to create a detail view in relationship with master view. I had found some examples but I just can not in this work. You help me please? Thanks in advance


Solution

  • It would help to see what kind of code you've already tried in order to accomplish this task with your Listdatasource. I tend to keep my master and detail grids separate, repopulating the child when the focused row is changed, so I wonder if this kind of pattern would help. It presumes master and detail would be linked by a parentID key in both tables.

    private void Parentgv_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
    
    {
    
    int parentID = Parentgv.GetRowCellValue(Parentgv.FocusedRowHandle, colparentID);
    
    childgc.datasource = childtable(c=>c.parentID == parentID);
    
    }