Hi everyone, I was wondering how to build a treeview from a table in my db witch has the followings fields: RowId, NodeName, ParentNodeId.
I will appreciate any help please.

Recommended Answers

All 3 Replies

Hi, I have a similar situation as posted in the tread you suggested only I donĀ“t want to do it trough a class, how can I make it so the treeview will load up directly from the db?
The fields on my db are: ID, ParentId, NodeText.
Thanks very much, I will really appreciate any help

You can always purchase the InfoPower controls for dot-net. They have a sub-classed TreeView that connects directly to a dataset with multiple relationships to display the tree.

Or roll your own. Bottom line is that the treeview is not a true data-aware component out of the box. Check out this link: http://www.codeproject.com/KB/tree/dbTree.aspx for work originating with Duncan Mackenzie. It is a sub-classed TreeView component that might meet you needs.

In any case, you are going to have to write code (most likely a new class or component) to populate the tree. Keep in mind that typically 99% of the time, you are going to want to get to that table record to do additional work. IOW it is not just enough to display data... you need to be able to get to the underlying record.

// Jerry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.