[RESOLVED] [2005] Nested Datatables in a single DataGridView
Greetings. Is there a way to nest two Datatables in a single Datagridview so that the data is displayed like so:
+ Parent Row #1
- Parent Row #2
. - Child Row related to Parent Row #2 (1)
. - Child Row related to Parent Row #2 (2)
. - Child Row related to Parent Row #2 (3)
+ Parent Row #3
+ Parent Row #4
I have an example of something similar using a DataGrid, but can not find a reference to this with the DataGridView. Here is the code used with the DataGrid:
Code:
Dim student_is_relation As DataRelation = _
scores_dataset.Relations.Add( _
"Student Test Scores", _
students_table.Columns("StudentId"), _
test_scores_table.Columns("StudentId"))
student_is_relation.Nested = True
grdScores.DataSource = scores_dataset
Re: [2005] Nested Datatables in a single DataGridView
The DataGridView does not support that functionality.
Re: [2005] Nested Datatables in a single DataGridView
With the DataGridView set up as the replacement for the DataGrid, is there any reason why I should not use the DataGrid (problems that I may not be aware of)?
Re: [2005] Nested Datatables in a single DataGridView
This is the major deficiency of the DataGridView class in my opinion. Given that it's an improvement on the DataGrid in basically every other way I would have expected improved relationship navigation, not worse. I was very disappointed when I discovered this. It's not a feature that gets used all the time, which is why I guess they felt justified leaving it out, but it would have been nice.
Anyway, if you want such navigation then it's the DataGrid or a third-party offering, which is likely to be not cheap. The DataGrid is a b*gger to custimise compared to the DataGridView and doesn't have as attractive UI, but what can you do?
Re: [2005] Nested Datatables in a single DataGridView
This feature would have been very nice for my app, but I can live with two related DGVs. Thanks you’re your thoughts on this subject.
Cheers