We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid hierarchical data structure (many-to-many)

Hi, I have a Database and a corresponding dataset with a few tables. Some of the tables have many-to-many relations established by a link table. For example, a vendor supplies merchandise to many stores and a store purchases from many vendors. So, I have Vendors Table, I have Stores Table and I also have a StoresToVendors link table. StoresToVendors table stores the primary keys from the other two tables as foreign keys in two columns. Now, how can I create a Grid with two levels of hierarchical rows, one for the Store (Parent) and another for Vendors (Children), or vice versa, without showing the link table in the picture at all? What is the best and easiest way to do this? Can somebody point me to any sample C# code, if any? Any help is appreciated. Thanks. Babu

1 Reply

AD Administrator Syncfusion Team February 29, 2004 10:12 PM UTC

One way you can approach this is to define a relation between your CompanyTable (parent table) and your CompanyToVendorsTable (child table). But in the child table, instead of showing the records from the child table, use unbound columns to show records from the VendorsTable. This requires handling model.QueryCellInfo to populate the unbound columns directly from the VendorsTable. Here is a little sample. ManyToManyHierarchicalGrid_7641.zip

Live Chat Icon For mobile
Up arrow icon