Hello,
There are a number of examples out there in the VS.NET on-
line help, but here's a pretty good one: *Walkthrough:
Creating a Master-Detail Windows Form*. It uses a
datagrid and a listbox, but the idea is the same.
You build the master/slave datatables, then build the
datarelation. You bind table 1 to datagrid 1
(setbindings), but instead of binding datagrid 2 to the
child table you *bind it to the datarelation*.
For example, table 1 is OrderHeader and table 2 is
OrderDetail. You build the datarelation on OrderID and
name that relation "OrderRelation". Bind datagrid 1
to "OrderHeader" and datagrid 2
to "OrderHeader.OrderRelation", and you're good to go.
If you bind grid 2 to the child table, even with the
relation set, you'll just get two unrelated grids.
One other thing: there's a property on the datagrid
called AllowNavigation. If that's true (default), then
you get plus signs on the parent grid, which you can
expand to view the child details right in the parent
grid. Cool, but can also be annoying--I think like you
that using the two grids is a better approach.
There's also a great book out there, ADO.NET Cookbook
(O'Reilly), that talks about your case in detail, along
with tons of other how-to's that you don't get as simply
from the on-line docs.
hth,
Bill Borg
-----Original Message-----
I am looking for working examples of making use or 2 datagrids and one dataset
Grid 1 master Display minimul info
Grid 2 slave. Disply detail info
When the user clicks a row on the master I then load
Grid 2 with detail information.