Home Forums WinForms controls Xceed Grid for WinForms Master Detail & Sub Detail Grid

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

    Hi,

    I am trying to have a master grid linked with Detail grid, which further is liked to a another detail grid. nested grids.

    But when i try to populate the datasets i am not able to link the master field with the detail fields. It shows all the records of detail dataset attached with each of the master records. Can you guide me what went wrong in my understanding. the code that i am trying is as below.Here below , I am trying to achieve master and detail releationship.Is the GridControl.Title a important property or that can be set anything ?

    It raises a error as below.
    5 – Child list for field imslocal cannot be created.
     

    probably what i am missing is the relation or the key to link between the two data sets…. am new to ado.net, if any tips on this to link it with xceed grid conttol will be much helpful.

     

    vb.net code ………………………

     szMasterDS à My MASter Dataset , data for master grid

    qry = select top 5 Cint(ss_id) as S_ID, [parent ssid] as PSSID from imslocal

    szMasterdetailDS à My Detail Dataset, Data for Detail Grid.

     qry = Select * from IMSCostCenter (there exists a field ss_id in  this table)

     

    For some reason , this is limited to MS Access.

     

    szUSrCtrl.BeginInit()

    szUSrCtrl.SetDataBinding(szMasterDS, szMasterDS.Tables(0).TableName)

     

           

            ‘ ad detail dataset to detail grid

            Dim MasDetTemplate As New DetailGrid()

      MasDetTemplate.SetDataBinding(szMasterdetailDS, _

            szMasterdetailDS.Tables(0).TableName)

            MasDetTemplate.HeaderRows.Add(New ColumnManagerRow())

            MasDetTemplate.Collapsed = True

                  XceedGridContainer.SetGridStyle(MasDetTemplate)

     

            szUSrCtrl.Title = “Master”

            MasDetTemplate.Title = “Details”

     

            szUSrCtrl.DetailGridTemplates.Add(MasDetTemplate)

            szUSrCtrl.UpdateDetailGrids()

     

     

            szUSrCtrl.ScrollBars = Xceed.Grid.GridScrollBars.Both

     

            m_spacerRow = New SpacerRow()

            m_spacerRow.Height = 4

     

            With szUSrCtrl

                .DataRowTemplate.AutoHeightMode = AutoHeightMode.AllContent

                .DataRowTemplate.FitHeightToEditors = True

                .FixedHeaderRows.Add(m_spacerRow)

            End With

     

            AdjustColumnWidth(szUSrCtrl)

            ExpandLastColumn(szUSrCtrl)

     

            szUSrCtrl.EndInit()

     

    Regards,

    Kalpesh

     

     

    Imported from legacy forums. Posted by Credits (had 2373 views)

    User (Old forums)
    Member
    Post count: 23064

    Basically, this is a problem in the way you set the DataSource and the DataMember properties.

    The best way to go is to set the same DataSource to all the grids and set the DataMember to the relationship name of each level of detail grids.

    e.g. :

    gridControl1.BeginInit();

    gridControl1.SetDataBindings( dataSet11, “Customers” );

    DetailGrid dgrid1 = new DetailGrid();
    DetailGrid dgrid2 = new DetailGrid();

    gridControl1.DetailGridTemplates.Add( dgrid1 );
    dgrid1.SetDataBindings( dataSet11, “Customers.Customers_Orders” );

    dgrid1.DetailGridTemplates.Add( dgrid2 );
    dgrid2.SetDataBindings( dataSet11, “Customers.Customers_Orders.Orders_OrderDetails” );

    gridControl1.EndInit();

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

    User (Old forums)
    Member
    Post count: 23064

    Thanks.

    It works now ….I was missing on setting the relationship name at each levels.

     

    Imported from legacy forums. Posted by Credits (had 680 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

     I’m using the same logic to display the master detail data. But there’s an issue, it is taking too long(more than 3 minutes) to display the data. Actually, my master table have approximately 30k records and there are 30-40 detailed grids with 3 or 4 records on an average. When I debug the code masterGridControl.UpdateDetailGrids()  is taking almost all the time. Is there any other way to optimise my code?? your advise is highly appreciated.

    Following is my code…….

    tmsDataSet.Relations.Add(“Rel_Sample”, xxDataSet.masterTable.IdColumn,

    xxDataSet.detailTable.IdColumn, false);

    masterGridControl.BeginInit();

    masterGridControl.SynchronizeDetailGrids =

    true;

    masterGridControl.SetDataBinding(xxDataSet, “masterTable”);

    DetailGrid detGrid = new DetailGrid();

    detGrid.SetDataBinding(xxDataSet,

    “masterTable.Rel_Sample”);

    InitialiseDetailGrid(detGrid ,

    “masterTable”);

    masterGridControl.DetailGridTemplates.Add(detGrid);

    masterGridControl.UpdateDetailGrids();

    masterGridControl.EndInit();

     

    Imported from legacy forums. Posted by Ram (had 379 views)

    User (Old forums)
    Member
    Post count: 23064

    To clarify things, are you saying there are 30 to 40 DetailGrids for every master rows, or 30 to 40 DetailGrids for the whole master grid?

    If you mean the first option, this means 2.7 million rows minimum ( 30k records X 30 DetailGrids X 3 detail rows ).

    In this case, since the grid does not offer a virtual mode (loading data on the fly as needed), the only option you have is to implement your own data paging (that is, make your data source give only the rows you need to display, and request rows as needed), or use idle time in your application to load records into the DataSet, which means the grid will added them automatically, and eventually, all records will be loaded.

     

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

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