I'm having trouble with a treeview, in ASP.NET.
I'm basically querying a database table. 3 of the colums are important
- Name
- Id
- ParentId
So this amounts to a bunch of Nodes in the TreeView, some which will have Child Nodes, Child Nodes may have more Child Nodes themselves, etc... Top Nodes don't have a ParentId, they are set to null, to indicate that they're top level nodes.
The problem I'm running in to is that there doesn't seem to be a way to add Child Nodes after the Top Nodes have been set.
What I'm looking for it something like this
Top
--First Topnode
--Second Topnode
--Third Topnode
----ChildNode 1
----ChildNode 2
------Sub Childnode 1
--Fourth Topnode
--Fifth Topnode
--Sixth Topnode
"Top" is actually the top node, which then contains the top ideas, sub ideas, etc...
And I can't seem to add childnodes on Top, or any TreeView.
The Add()
only accepts strings as data. Is there any way I can make it accept a List<> or TreeNodes? Or any other way that I can insert a set of nodes to be childnodes of any existing node?
EDIT: Nevermind, I found it. Apparently, the "Nodes" getter is apparently an Array. Meaning you can do this:
myTreeView.Nodes[0].ChildNodes.Add()
Please close