Click here to Skip to main content
15,935,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi, I have two datagridview controls showing a master/detail relationship, the master loads just fine, but the detail is not loading the relative records!
ps. The model was created using the designer, (ie. dragged from the database side pane)
Please help.
Ankur\m/ 16-Apr-11 1:50am    
It's difficult to tell the reason without seeing the relevant code. Try putting a debugger to see if the code fails somewhere.
Muammar© 16-Apr-11 8:45am    
It never fails, just doesn't load any rows from the child table.. I just don't see why we can't create such a basic master/detail grids using the designer!

If you have established the parent child relationship then at an event from the parent gridview get the row id. Use the GetChildRows function and bind the results to the second datagridview.

for more information[^]
Share this answer
Muammar© 16-Apr-11 8:43am    
Thanks mate, but it's not helping me.. You see, I'm totally relaying on the designer and even if it worked out your way, it will still be misleading as loaded data won't be saved if updated!!
Thanks anyways mate.

ps. I tried this:
<pre>myTableBindingSource.DataSource = myDataSet.myTable.Rows[myDataGridView.CurrentRow.Index].GetChildRows(@"myRelationship");</pre>
Ok, i don't know what exactly is the problem but vs 2010 seems to handle it just fine, I'm still interested to know the reason if somebody found out what the problem was.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900