Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Using the TreeView control to create an Org Chart

Reply
Thread Tools

Using the TreeView control to create an Org Chart

 
 
Rob Edwards
Guest
Posts: n/a
 
      12-04-2003
I'm trying to use the TreeView web control to create an org chart from an
Employee table.

Table: Employee
Fields:
EmployeeID
EmployeeLastName
EmployeeFirstName
ManagerID

Where ManagerID is another record in the same Employee table.

I would like to use the Treeview control to traverse down the org chart...
using the relationshp between EmployeeID and ManagerID....

Can someone help get me started on the right track?

Thanks


 
Reply With Quote
 
 
 
 
MSFT
Guest
Posts: n/a
 
      12-05-2003
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 04-04-2011 10:00 PM
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 02-03-2011 11:00 AM
A real challenge: Create a Gantt-chart-like chart gnewsgroup ASP .Net 4 02-06-2008 02:27 PM
ASP can generate a chart (pie chart) ? Tarek ASP General 6 11-19-2004 06:33 PM
Re: Dynamic Org Chart Bob Wagner ASP .Net 1 07-03-2003 01:06 PM



Advertisments