Click here to Skip to main content
Licence 
First Posted 12 Jun 2003
Views 156,438
Downloads 4,721
Bookmarked 40 times

ASP.NET Tree Control

By Murthy Rojukhirdu | 12 Jun 2003
ASP.NET tree control is a Custom Control (.ascx) that builds a tree structure. All you have to do is to use two methods of the control. The AddNodeDiv which will add the Node and BuildTree which will build it.
10 votes, 40.0%
1
4 votes, 16.0%
2
2 votes, 8.0%
3
4 votes, 16.0%
4
5 votes, 20.0%
5
2.69/5 - 25 votes
μ 2.48, σa 2.86 [?]

Sample Image - Preview.gif

Introduction

ASP.NET tree control is a Custom Control (.ascx) that builds a tree structure. All you have to do is to use two methods of the control. The AddNodeDiv which will add a Node and BuildTree which will build it. Please note that the Node type parent should be only used for the first level nodes. The Node Click event is raised and the source code is in JavaScript file. The control also selects the current node. You can make this as a DLL by just copying the methods and properties to a class file

The following will explain how to use the control:

  1. Add the mrTree.ascx, mrtree.ascx.vb, mrFunctions.js, plus.gif, minus.gif files to your Visual Studio .NET project.
  2. Drag the mrTree.ascx to your aspx page (in design mode).
  3. Declare your tree (Public mrTree1 As mrTree)
  4. Use the AddNodeDiv method of the Tree to build your nodes (See examples).
  5. Once you have added all your Nodes, call the BuildTree() method to build the tree.
  6. If there are any errors in building, the control will write it to Errors property of the tree.
  7. The JavaScript file has the function which run when you click the node.
  8. You can always change the source code to fit your needs.

I hope this helps.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Murthy Rojukhirdu

Web Developer

United States United States

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralCode License Pinmemberqbak2212:32 28 Jun '07  
QuestionIs it possible to create .dll file from user controls(.ascx) in C# .net PinmemberYasotha Devi21:26 24 Oct '06  
Generali can't move tree PinmemberCenturion20001:07 2 May '06  
GeneralNull Exception Pinmemberamardeep dabass20:51 1 Jan '06  
GeneralParent node display problem PinmemberMichael Waddell13:41 17 Feb '05  
GeneralTreeview with database Pinmemberhelgapataki6:56 22 Nov '04  
GeneralPostBack Pinmemberzorrer2:55 22 Nov '04  
Generaldocument.all property not W3C instead Pinmemberismail codar.7:00 7 Oct '04  
GeneralI tried to use this code but it's not working in Netscape. Pinmemberkishorereddy11:27 9 Sep '04  
GeneralTree Control needs some tweaking. PinmemberJeepy13:53 30 Jun '04  
GeneralEven More Tweaking = Performance! PinmemberJeepy9:01 1 Jul '04  
GeneralRe: Even More Tweaking = Performance! PinmemberJeepy14:21 7 Jul '04  
GeneralRe: Even More Tweaking = Performance! PinmemberNithing21:38 18 Sep '08  
GeneralMake sure NodeKey doesn't have :\ PinmemberJeepy9:30 22 Jun '04  
GeneralTree in DLL Pinmemberoksanai@012.net.il22:16 13 Mar '04  
Generalimage on tree view control Pinmembersathiya88819:36 2 Nov '03  
GeneralRe: image on tree view control PinmemberDustin Burke9:17 11 Aug '05  
GeneralLength of content PinmemberJason McBurney10:18 13 Jun '03  
GeneralRe: Length of content PinmembertheJazzyBrain3:28 18 Jun '03  
GeneralRe: Length of content PinsussAnonymous0:29 20 Jun '03  
GeneralRe: Length of content PinsussAnonymous3:58 18 Jun '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120209.1 | Last Updated 13 Jun 2003
Article Copyright 2003 by Murthy Rojukhirdu
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid