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
<%@ 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