This question is locked. New answers and comments are not allowed.
Hi,
I'm working with ORM for the first time and have worked through the online demonstration to build a simple vb.net Winforms application.
I'm using my own SQL Server DB and would like to get linked master-detail grids (the standard .net DataGridView controls) working. So my example is a one-to-many relationship between customers and contracts. The master grid will be customers and the detail grid will show all contracts belonging to that customer.
On my form I have two DGVs and this code:
When I run the application, things look good. The master grid has all the customers and the detail grid shows the contracts for that customer. However, when I select another customer in the master grid, nothing is displayed in the contracts - the link seems to be lost.
Am I missing something simple?
Thanks,
Chris.
I'm working with ORM for the first time and have worked through the online demonstration to build a simple vb.net Winforms application.
I'm using my own SQL Server DB and would like to get linked master-detail grids (the standard .net DataGridView controls) working. So my example is a one-to-many relationship between customers and contracts. The master grid will be customers and the detail grid will show all contracts belonging to that customer.
On my form I have two DGVs and this code:
Private
dbContext
As
New
TelerikDBContext()
Private
bsCustomers
As
New
BindingSource
Private
bsContracts
As
New
BindingSource
Private
Sub
Form1_Load(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
MyBase
.Load
Me
.bsCustomers.DataSource = dbContext.TblCustomers.ToList()
Me
.bsContracts.DataSource = bsCustomers
Me
.bsContracts.DataMember =
"tblcontracts"
Me
.DataGridView1.DataSource = bsCustomers
Me
.DataGridView2.DataSource = bsContracts
End
Sub
When I run the application, things look good. The master grid has all the customers and the detail grid shows the contracts for that customer. However, when I select another customer in the master grid, nothing is displayed in the contracts - the link seems to be lost.
Am I missing something simple?
Thanks,
Chris.