Current filter:
                                You should refresh the page.

                                How to use DataTable with master-detail relationships in TreeList.

                                0

                                This example demonstrates how to use DataTable with the master-detail relationship in TreeList

                                The XtraTreeList control provides different mechanisms (Data Binding Modes) to display data.
                                When DataTable is assigned to the TreeList DataSource property (Bound Mode) TreeList can show data only from the underlying DataTable and does not take into account datasource relations.
                                To show related data in TreeList, use the Dynamic Loading in Unbound Mode or the Dynamic Data Loading in an Events mode.

                                You must  log in  or  register  to leave comments
                                Select file
                                • Form1.cs
                                • Program.cs
                                • UnboundMasterDetailTree.cs
                                • VirtualMasterDetailTree.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2009 vol 3.2 - v2012 vol 2.8
                                using System;
                                using System.Collections.Generic;
                                using System.ComponentModel;
                                using System.Data;
                                using System.Drawing;
                                using System.Text;
                                using System.Windows.Forms;
                                using treelist;
                                
                                namespace E3597
                                {
                                    public partial class Form1 : Form
                                    {
                                        DataSet1 ds = new DataSet1();
                                        public Form1()
                                        {
                                            InitializeComponent();
                                            FillDataSet();
                                            VirtualMasterDetailTree virtualHelper = new VirtualMasterDetailTree(treeList1, ds.MasterTable);
                                            UnboundMasterDetailTree unboundHelper = new UnboundMasterDetailTree(treeList2, ds.MasterTable);
                                
                                        }
                                        void FillDataSet()
                                        {
                                            for (int i = 0; i < 5; i++)
                                            {
                                
                                                ds.MasterTable.Rows.Add(i, "Master " + i);
                                                for (int j = 0; j < 5; j++)
                                                {
                                                    ds.Child1.Rows.Add(i * 100 + j, i, "Child1:" + j);
                                                    for (int k = 0; k < 5; k++)
                                                    {
                                                        ds.Child3.Rows.Add((i * 100 + j) * 100 + k, i * 100 + j, "Child3:" + k);
                                                    }
                                                }
                                            }
                                        }
                                
                                    }
                                }