Nested Datagrid

Smokeywade

Member
Joined
Sep 11, 2007
Messages
22
Programming Experience
3-5
I'm using datarelation to create a masterdetail - My question is - how will I show the record inline?
Currently when click on a record in the grid to open the nested table it creates a link ("Line View") - then I have to click that link to open the table - I want to be able to do this with just one click - This is my code creating the master detail.
How can I display the table inline with the master?
VB.NET:
 Dim command1 As New SqlCommand("Select * FROM LateOrders_Header_view", cnn1)
Dim command2 As New SqlCommand("Select * from LateOrders_Line_view", cnn1)
'Dim SqlReader As SqlDataReader
Try
cnn1.Open()

'Debug.WriteLine(cnn1.ConnectionString)
Dim dt As New DataTable("LateOrders_Header_view")
'dgOrderReport.DataSource = dt
Dim DirAdapter As New SqlDataAdapter(command1)
Dim DirAdapter2 As New SqlDataAdapter(command2)
Dim dc1 As DataColumn
Dim dc3 As DataColumn

MyDataSet = New DataSet
DirAdapter.TableMappings.Add("table1", "LateOrders_Header_view")
DirAdapter.TableMappings.Add("table2", "LateOrders_line_view")

DirAdapter.Fill(MyDataSet, "LateOrders_Header_view")
DirAdapter2.Fill(MyDataSet, "LateOrders_Line_view")

dc1 = MyDataSet.Tables("LateOrders_Header_view").Columns("order_no")
dc3 = MyDataSet.Tables("LateOrders_Line_view").Columns("order_no")

Dim datarelation As DataRelation
datarelation = New DataRelation("Line View", dc1, dc3, False)

MyDataSet.Relations.Add(datarelation)

dgOrderReport.DataSource = MyDataSet.DefaultViewManager '.CreateDataView.Tables("LateOrders_Header_view").DefaultView
dgOrderReport.DataMember = "LateOrders_header_view"
 
Back
Top