Winform Nested Datagrids - Question
-
How will I show the child table within the parent table without having to clink on the link - example My main grid loads up fine and it shows the '+' '-' to expand the table, but when I click the '+' I get "datarelation" link once I click that link the table expands. Is it possible to do this with just one click on the '+'? Dont want to use two datagrids, because I want all the info on one grid. Will I have to purchase a third pary product to do this? Here is my code below - am I doing something wrong?
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 Dim datarelation As DataRelation MyDataSet = New DataSet DirAdapter.TableMappings.Add("tabel1", "LateOrders_Header_view") DirAdapter.TableMappings.Add("tabel2", "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") datarelation = New DataRelation("Line View", dc1, dc3) MyDataSet.Relations.Add(datarelation) 'dc3.ReadOnly = True dgOrderReport.DataSource = MyDataSet.DefaultViewManager '.Tables("LateOrders_Header_view").DefaultView dgOrderReport.DataMember = "LateOrders_header_view"
Any Ideas?Thank You
-
How will I show the child table within the parent table without having to clink on the link - example My main grid loads up fine and it shows the '+' '-' to expand the table, but when I click the '+' I get "datarelation" link once I click that link the table expands. Is it possible to do this with just one click on the '+'? Dont want to use two datagrids, because I want all the info on one grid. Will I have to purchase a third pary product to do this? Here is my code below - am I doing something wrong?
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 Dim datarelation As DataRelation MyDataSet = New DataSet DirAdapter.TableMappings.Add("tabel1", "LateOrders_Header_view") DirAdapter.TableMappings.Add("tabel2", "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") datarelation = New DataRelation("Line View", dc1, dc3) MyDataSet.Relations.Add(datarelation) 'dc3.ReadOnly = True dgOrderReport.DataSource = MyDataSet.DefaultViewManager '.Tables("LateOrders_Header_view").DefaultView dgOrderReport.DataMember = "LateOrders_header_view"
Any Ideas?Thank You
so wht,s the problem simply just apply the condition on + button and - button. +button.click=dgv1, dgv2 else false hope u understand byeeeeeeee lucky
-
so wht,s the problem simply just apply the condition on + button and - button. +button.click=dgv1, dgv2 else false hope u understand byeeeeeeee lucky
Nope I dont understand - I dont have any button conditions because of this below-
datarelation = New DataRelation("Line View", dc1, dc3) MyDataSet.Relations.Add(datarelation)
creates the + - condition on the grid. When the app is running when I click on a record it expands and you see a link that says "Line View" once I clink that link it opens a different table - I dont want it to do that I want it to show the nested table with just one click on the row Is there away to raise a condition to control the + and - that comes with datarelation? Oh Yea I'm not using two datagrids - One datagrid with two datasets. Well One dataset two tables. -- modified at 8:28 Friday 7th September, 2007 -- modified at 9:30 Friday 7th September, 2007Thank You