Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Iron Man Contest - Answer This And You Are King

Status
Not open for further replies.

Speccy

MIS
May 18, 2006
5
US
VBScript/ASP.Net Creating a tree structure using 'DirectoryTree'

<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>

tNode = new TreeNode()
tNode.Text = "Departmental Reports"
tNode.ImageUrl="folder.gif"
tNode.ExpandedImageUrl="FolderOpen.gif"
'TreeView1.Nodes.Add(tNode)
DirectoryTree.Nodes.Add(tNode)

'Iterate through each directory and get directories and files underneath
for each strItem in DirArray
tNode1 = new TreeNode()
'Cosmetically change to month names
tNode1.Text = EmployeeName + " - " + Period_to_month(strItem)
tNode1.ImageUrl="folder.gif"
tNode1.ExpandedImageUrl="FolderOpen.gif"
DirectoryTree.Nodes.Add(tNode1)
AddSubDirectories(DirPath + UserName + "\" + strItem , tNode, URL + UserName + "/" + strItem)
AddSubFiles(DirPath + UserName + "\" + strItem , tNode1, URL + UserName + "/" + strItem)
next

The code above should create a tree structure looking something like this:

--> [Departmental Reports] []=A Folder
--> [Month]
--> ReportListing
--> [Month]
--> ReportListing

What I get is:

[Departmental Reports] -Empty
[Month]
--> Report Listing

What I need to know is how to put the [Month] folders into the [Departmental Reports] folders.

The catch here is that I'm using DirectoryTree and not TreeView because I'm reading information from a directory.

I've been at this one all day, anyone who can lead me to an answer is a better man than me and I'll give him maximum ticks to prove it.

Speccy
 
I am king (of what I'm not sure)

tNode1.Nodes.Add(tNode)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top