Master-details question

H

HS1

Hello all

I followed the example in Visual Studio.net to create a master and detail
relationship as following:

two tables: Customers and Orders
two DataGrid: GridOrders and GridDetails
--------------
Dim myDataRelation As DataRelation

myDataRelation = New DataRelation (
"CustomerOrder",dataSet.Table("Customers).Columns("CustomerID"),
ds.Tables("Orders").Columns("CustomerID"))
dataSet.Relations.Add(myDataRelation)
GridOrders.SetDataBindings(dataSet, "Customers")
GridDetails.SetDataBindings(dataSet, "Customers.CustomerOrder")
----------------------------------

The code work OK.When I click on a sign (+) in a record in a Master Grid
(GridOrders), I can see a lower link "CustomerOder ". then when I click in
that link, the "Detail" of that record will be shown in the Detail Grid.

Do you know a way so that when I click on the (+) sign, the Detail Grid will
show details of the record (that means I don't have to click to the link any
more- I don't need this link- similarly to Form and Subform in Microsoft
Access)

Many thanks
S.Hoa
 
K

Ken Tucker [MVP]

Hi,

If you are already showing the detail records in a second grid why
not set the datagrids allownavigation property to false so the + doesnt show
up at all.

Ken
--------------
Hello all

I followed the example in Visual Studio.net to create a master and detail
relationship as following:

two tables: Customers and Orders
two DataGrid: GridOrders and GridDetails
--------------
Dim myDataRelation As DataRelation

myDataRelation = New DataRelation (
"CustomerOrder",dataSet.Table("Customers).Columns("CustomerID"),
ds.Tables("Orders").Columns("CustomerID"))
dataSet.Relations.Add(myDataRelation)
GridOrders.SetDataBindings(dataSet, "Customers")
GridDetails.SetDataBindings(dataSet, "Customers.CustomerOrder")
----------------------------------

The code work OK.When I click on a sign (+) in a record in a Master Grid
(GridOrders), I can see a lower link "CustomerOder ". then when I click in
that link, the "Detail" of that record will be shown in the Detail Grid.

Do you know a way so that when I click on the (+) sign, the Detail Grid will
show details of the record (that means I don't have to click to the link any
more- I don't need this link- similarly to Form and Subform in Microsoft
Access)

Many thanks
S.Hoa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top