3 level master detail

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

HI Guys,

I'm trying to create a master detail form with 3 levels.

Let's say I have a list of custommers who all have a number of order
who in turn have a number of orderlines.

I would like to have 1 form with 3 datagrids. One with the custommers
one with the orders and one with the orderlines.

Now I can't seem to manage to get this working. 2 synchronised
datagrids is easy, but what about the thrid?

Can this be done at desing time?

If this needs to be done programmatically, what would be the most
efficient way to get the key value from the first datagrid, and what
would be the most efficient way to get the correct records from the
detail records?

Thx,
Kryptonneke
 
Hi,

This can be done both in the designer and the code, the important thing is
to keep the same binding path.

dgCustomers.DataSource = ds;
dgCustomers.DataMember = "Customers";

dgOrders.DataSource = ds;
dgOrdres.DataMember = "Customers.CustomersOrders";

dgOrderLines.DataSource = ds;
dgOrderLines.DataMember = "Customers.CustomersOrders.OrdersOrdersLines";

Notice that each DataMember property is set to the next level relationship,
in this case the relationships where CustomersOrdres, then
OrdersOrdersLines. The DataSource must be consistent through out.

Hope this helps

Chris Taylor
 
Hi,

I did just this I think. However grid 1 and 2 are in sync, but grid 3
doesn't seem to move.

What I did was in de dataset create a relationship between customers
and orders and one between orders and orderlines.

and then probably something like
dgCustomers.DataSource = ds;
dgCustomers.DataMember = "Customers";

dgOrders.DataSource = ds;
dgOrdres.DataMember = "Customers.CustomersOrders";

dgOrderLines.DataSource = ds;
dgOrderLines.DataMember "Orders.OrdersOrdersLines";

I will have to check this out. Will let you know.

Thanks,
Andy
 
Andy said:
I'm trying to create a master detail form with 3 levels.

Let's say I have a list of custommers who all have a number of order
who in turn have a number of orderlines.

I would like to have 1 form with 3 datagrids. One with the custommers
one with the orders and one with the orderlines.

Now I can't seem to manage to get this working. 2 synchronised
datagrids is easy, but what about the thrid?

Can this be done at desing time?

If this needs to be done programmatically, what would be the most
efficient way to get the key value from the first datagrid, and what
would be the most efficient way to get the correct records from the
detail records?

http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q1012q

You can also use events with the binding contexts, which is pretty
easy to set up. That way you can extend the grid hierarchy to even 4 or 5.

FB
 
Hi,

The problem is the DataMember path in the 3rd DataGrid. Your path is not
through Customers.CustomersOrders relationship, but through the Orders
table. Think of it like separate views, while the 2nd Grid is viewing data
in the Customers.CustomersOrders view and this is the view you should
synchronise on to build the view for the OrdersOrdersLines relationship.

dgOrderLines.DataMember = "Customers.CustomersOrders.OrdersOrdersLines";

Hope this helps

Chris Taylor
 
Yep, it works now.
Thanks!!!.

Andy
Hi,

The problem is the DataMember path in the 3rd DataGrid. Your path is not
through Customers.CustomersOrders relationship, but through the Orders
table. Think of it like separate views, while the 2nd Grid is viewing data
in the Customers.CustomersOrders view and this is the view you should
synchronise on to build the view for the OrdersOrdersLines relationship.

dgOrderLines.DataMember = "Customers.CustomersOrders.OrdersOrdersLines";

Hope this helps

Chris Taylor
 
I'm glad you got it working.
Maybe you can figure out what I'm doing wrong or give me a walkthrough of
how you got yours to go.
See my post at 'parent, child, grandchild schema'
Thanks,
Roger
 
Back
Top