I have a header table that has a list of web pages in it. Each record has a page URL field which I am looking to parse out into a hierarchy (TreeView). I am not sure of the best way to go about it and I am having a problem getting it to work.
Here's an example of URLS:
/file1.aspx
/file2.aspx
/aFolder/file.aspx
/aFolder/file2.aspx
/bfolder/file.aspx
/bFolder/cFolder/file.aspx
I want to put this type of a list into a file explorer style treeview that you can expand the folders and then select the file at the end.
Something like
--Root
|
+-aFolder
| - aFolderFile1.aspx
| - aFolderFile2.aspx
+-bFolder
+-cFolder
| -cFolderFile1.aspx
-bFolderFile1.aspx
The real data obviously has more sub folders and files in each.
What I am looking for is some code, be it .NET or SQL to parse my strings. I have tried to use some SQL that used WITH and UNION ALL but I just can't get it to work for me.
In order to bind it to a TreeView, the data source needs to have a parent field in order to relate the nodes. So, for example the parent for the file cFolderFile1.aspx is cFolder and the cFolder has a parent of bFolder, and so on....
Hopefully I've included enough information. If not, please let me know and I will edit the post.