Click here to Skip to main content
11,704,509 members (55,685 online)
Click here to Skip to main content

ASP.NET Tree Control

, 12 Jun 2003 167.5K 5.1K 40
Rate this:
Please Sign up or sign in to vote.
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.

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

Share

About the Author

Murthy Rojukhirdu
Web Developer
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralCode License Pin
qbak2228-Jun-07 11:32
memberqbak2228-Jun-07 11:32 
QuestionIs it possible to create .dll file from user controls(.ascx) in C# .net Pin
Yasotha Devi24-Oct-06 20:26
memberYasotha Devi24-Oct-06 20:26 
Generali can't move tree Pin
Centurion20002-May-06 0:07
memberCenturion20002-May-06 0:07 
GeneralNull Exception Pin
amardeep dabass1-Jan-06 19:51
memberamardeep dabass1-Jan-06 19:51 
GeneralParent node display problem Pin
Michael Waddell17-Feb-05 12:41
memberMichael Waddell17-Feb-05 12:41 
GeneralTreeview with database Pin
helgapataki22-Nov-04 5:56
memberhelgapataki22-Nov-04 5:56 
GeneralPostBack Pin
zorrer22-Nov-04 1:55
memberzorrer22-Nov-04 1:55 
Generaldocument.all property not W3C instead Pin
ismail codar.7-Oct-04 6:00
memberismail codar.7-Oct-04 6:00 
GeneralI tried to use this code but it's not working in Netscape. Pin
kishorereddy9-Sep-04 10:27
memberkishorereddy9-Sep-04 10:27 
GeneralTree Control needs some tweaking. Pin
Jeepy30-Jun-04 12:53
memberJeepy30-Jun-04 12:53 
GeneralEven More Tweaking = Performance! Pin
Jeepy1-Jul-04 8:01
memberJeepy1-Jul-04 8:01 
GeneralRe: Even More Tweaking = Performance! Pin
Jeepy7-Jul-04 13:21
memberJeepy7-Jul-04 13:21 
GeneralRe: Even More Tweaking = Performance! Pin
Nithing18-Sep-08 20:38
memberNithing18-Sep-08 20:38 
GeneralMake sure NodeKey doesn't have :\ Pin
Jeepy22-Jun-04 8:30
memberJeepy22-Jun-04 8:30 
GeneralTree in DLL Pin
oksanai@012.net.il13-Mar-04 21:16
memberoksanai@012.net.il13-Mar-04 21:16 
Generalimage on tree view control Pin
sathiya8882-Nov-03 18:36
membersathiya8882-Nov-03 18:36 
GeneralRe: image on tree view control Pin
Dustin Burke11-Aug-05 8:17
memberDustin Burke11-Aug-05 8:17 
GeneralLength of content Pin
Jason McBurney13-Jun-03 9:18
memberJason McBurney13-Jun-03 9:18 
GeneralRe: Length of content Pin
theJazzyBrain18-Jun-03 2:28
membertheJazzyBrain18-Jun-03 2:28 
GeneralRe: Length of content Pin
Anonymous19-Jun-03 23:29
sussAnonymous19-Jun-03 23:29 
GeneralRe: Length of content Pin
Anonymous18-Jun-03 2:58
sussAnonymous18-Jun-03 2:58 

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.

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