Hi Rob,
We may first fill a dataset wit the org table data, and add the nodes in
treeview. Here is a smaple on this:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim root As New Microsoft.Web.UI.WebControls.TreeNode
root.Text = "Org"
TreeView1.Nodes.Add(root)
SqlDataAdapter1.Fill(DataSet11)
addsubnode(0, root)
End Sub
Private Sub addsubnode(ByVal managerID As Integer, ByRef parentnode As
Microsoft.Web.UI.WebControls.TreeNode)
Dim dr As DataRow
Dim cnode As Microsoft.Web.UI.WebControls.TreeNode
For Each dr In DataSet11.org.Rows
If dr("ManagerID") = managerID Then
cnode = New Microsoft.Web.UI.WebControls.TreeNode
cnode.Text = dr("EmployeeFirstName") + " "
+dr("EmployeelastName")
parentnode.Nodes.Add(cnode)
addsubnode(dr("EmployeeID"), cnode)
End If
Next
End Sub
|