954,173 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to draw a Binary Tree Dynamically from Database, in ASP.NET C#

Hi, I have a database table which stores the information on the Node relationship.

In the table tblNode, I have :

tlbNodeRelation

NodeID - (The ID of the node)

ParentID
- (The ID of the Parent Node)

Position
- (The position this Node is in under the Parent Node. Either Left or Right)

then in another table where we store the information of the Node,

tblNodeData

NodeID

Username

Email

Now I need to draw out a binary tree, it has to be dynamic, as the Node might be added / deleted.

And I wish to create a link to the user profile when a person click on a certain node. Something visual like this.

[img]http://img132.imageshack.us/img132/5020/binarytreemt6.jpg[/img]

When i click each of the node, it will go to the profile page of the user.

I have no idea where to start this one, maybe a nested repeater ??

Thanks for all inputs and comments.

-mk-
Newbie Poster
10 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

last year i created a web custom control that achieves this. I will try to find it for you. My control was based on the information taken from http://aspalliance.com/732 , you can use that tutorial to achieve that, all i did was to embed that process into web custom control.

serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

nice tutorial. But i require the tree to be horizontal and with left and right sides.

any ideas that can be done ?

anyhow, thanks for your reply, it really helps me.

-mk-
Newbie Poster
10 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

if you want to achieve such a thing you should write your custom web control. it is not that hard, you are going to render pure html using the data from your database. Your visual representation logic is the hardest part i think. In html you dont have many tools to create a horizontal tree view like a chart.

serkan sendur
Postaholic
Banned
2,062 posts since Jan 2008
Reputation Points: 854
Solved Threads: 127
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You