Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Detail View for the child table in a Master/Detail form
 

Detail View for the child table in a Master/Detail form


I'm new to VB .NET programming and I'm stuck with this problem for the last 3 days. Any help is greatly appreciated.

I have two tables Master and Child. The tables are in a one to many relationship. I have a form which I should use to collect information for both the tables and also save the data.

The master table is set up as a details view and is linked to a binding navigator. I want to set up the child table also as a details view with its own binding navigator. I'm not sure how to do this. When I drag the child table onto the form as details view I cannot see any updates. But if I use the child table as datagridview then I'm able to insert, update and view the data without any problems. I cannot use a datagrid view due to the nature of data in the child table.

All the examples that I have seen uses the datagridview as the child for one to many relationships.Could someone please point me to an example or provide a direction to resolve this issue

Ignatius Narchetty  Monday, September 28, 2009 7:44 PM

Hi Ignatius,

You said: I want to set up the child table also as a details view with its own binding navigator.

Based on my understanding, the root issue is that when you move to one record of the head table, there are several records in detail table related to header table, but you can only see the first record in the details view of the detail table.

To have the user be able to select a record of the detail table, besides adding the details view of the header table and the detail table, we can add a DataGridView view of the detail table to the form. Then we are able to select one row in that DataGridView to select a record of the detail table.

If you would not like to add a DataGridView to the form, but need to add an own navigator bar to the form. We can add a BindingNavigator control to the form and set its BindingSource property to the BindingSource of the detail table(detailsBindingSource). Then we can use this navigator to select a record of the detail table. You can get more about how to use BindingNavigator control from: http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingnavigator.aspx

By the way, we can always save the data via the Save button of the head navigator to save the data. So it is unnecessary to add a new save button.

Let me know if this helps or not.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, September 30, 2009 10:06 AM

Hi Ignatius,

You said: I want to set up the child table also as a details view with its own binding navigator.

Based on my understanding, the root issue is that when you move to one record of the head table, there are several records in detail table related to header table, but you can only see the first record in the details view of the detail table.

To have the user be able to select a record of the detail table, besides adding the details view of the header table and the detail table, we can add a DataGridView view of the detail table to the form. Then we are able to select one row in that DataGridView to select a record of the detail table.

If you would not like to add a DataGridView to the form, but need to add an own navigator bar to the form. We can add a BindingNavigator control to the form and set its BindingSource property to the BindingSource of the detail table(detailsBindingSource). Then we can use this navigator to select a record of the detail table. You can get more about how to use BindingNavigator control from: http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingnavigator.aspx

By the way, we can always save the data via the Save button of the head navigator to save the data. So it is unnecessary to add a new save button.

Let me know if this helps or not.
Aland Li

Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Wednesday, September 30, 2009 10:06 AM

You can use google to search for other answers

Custom Search

More Threads

• Problem selecting rows in datagrid .net 1.1 after using FindRows
• SOS!!!! Urgent, datagrid column style
• listbox selected index changed
• Datagrid: Set value for textbox/column by selecting from drop-down list
• Refresh Image in a DataGridView
• DataGridView: values don't appear in DataGridViewComboBoxColumn
• Is there a difference between TableAdapter.Fill and TableAdapter.GetData?
• Populate dataGridView Columns with data when Columns already exist?
• XP 64-bit Datagridview redraw extremely slow
• Filter Datatable expression SQL