TreeView nodes can be accessed from either Nodes collection from the TreeView root or ChildNodes collection for a TreeNode. But you don’t have any native functions to list all nodes to a single level list. This article explains how to get all nodes with complete source code in VB.Net.
TreeView Preparations
To distinguish the levels I have made the lines visible by the property ShowLines as visible. I have used two DIVs to show the output and the TreeView side by side. Sitemap is going to be used for the sample data to bind the TreeView, So a SiteMapDataSource to bind the Sitemap to the TreeView.
Sample Data
To explain accessing all nodes in all levels of hierarchy, we need some sample data to fill up all levels. Here in our case we are going to deal that with a sitemap. So I have purposely created a sitemap with few levels and each level contains few items. I have named them in a way we can identify its level from looking at the name. Look the screen capture for further understandings.
For Source code Please refer (TreeView Nodes)
Friday, May 7, 2010
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment