Hi.
How to save TreeView. I have no problem read data from database, like this:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.TblSkydeHoldTableAdapter.Fill(Me.SkyttecenteretDataSet.tblSkydeHold)
Me.RadTreeView1.DisplayMember = "name"
Me.RadTreeView1.ParentMember = "pid"
Me.RadTreeView1.ChildMember = "id"
Me.RadTreeView1.ValueMember = "id"
Me.RadTreeView1.DataSource = Me.GetSampleData()
End Sub
Private Function GetSampleData() As DataTable
Dim dt As New DataTable()
Dim dc As New DataColumn()
dc.ColumnName = "id"
dc.DataType = GetType(Integer)
dt.Columns.Add(dc)
Dim dc1 As New DataColumn()
dc1.ColumnName = "name"
dc1.DataType = GetType(String)
dt.Columns.Add(dc1)
Dim dc2 As New DataColumn()
dc2.ColumnName = "pid"
dc2.DataType = GetType(Integer)
dt.Columns.Add(dc2)
Me.TblSkydeHoldTableAdapter.Fill(Me.SkyttecenteretDataSet.tblSkydeHold)
For Each dRow As DataRow In Me.TblSkydeHoldTableAdapter.GetData
Dim dr As DataRow = dt.NewRow()
dr(0) = dRow.Item("dr0")
dr(1) = dRow.Item("dr1")
dr(2) = dRow.Item("dr2")
dt.Rows.Add(dr)
Next
Return dt
End Function
But my problem starts when i want to save back to database. When i add a new node, the node have no parentmember value or valuemeber value. Is it possible to add those values automaticly when a new node is created?
Kindly Peter