treeview navigateurl

subNode.NavigateUrl = "WebDocuments/" & fi.Name.ToString() <<<<I can click on the items in the top folder called webdocumnets, but any items in subfolders will not pull up.  I understand that the url it is looking for is wrong, I'm just not sure how to get the subfolders in the url.
Dim directory As DirectoryInfo = Nothing
        directory = New DirectoryInfo(node.Value)

        For Each subtree As DirectoryInfo In directory.GetDirectories()
            Dim subNode As New TreeNode(subtree.Name)
            subNode.Value = subtree.FullName
            Try
                If subtree.GetDirectories().Length > 0 Or subtree.GetFiles().Length > 0 Then
                    subNode.SelectAction = TreeNodeSelectAction.SelectExpand
                    subNode.PopulateOnDemand = True
                    subNode.NavigateUrl = "#"
                End If
            Catch ex As Exception

            End Try
            node.ChildNodes.Add(subNode)
        Next subtree
        For Each fi As FileInfo In directory.GetFiles()
            Dim subNode As New TreeNode(fi.Name)
            node.ChildNodes.Add(subNode)
            subNode.NavigateUrl = "WebDocuments/" & fi.Name.ToString()
            'subNode.NavigateUrl = Server.MapPath(fi.Name.ToString())

Open in new window

LVL 2
bergertimeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
Try

subNode.NavigateUrl = "/WebDocuments/" & fi.Name.ToString()

or

subNode.NavigateUrl = "~/WebDocuments/" & fi.Name.ToString()
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bergertimeAuthor Commented:
Yeah, I tried that also, I get the same results.  If I click on a file in webdocuments then it works fine, if I click on a file that's in webdocuments/folder/doc.pdf then my url is site/webdocuments/doc.pdf.  It drops the subfolder.
0
CodeCruiserCommented:
To you add the subfolder to the navigateurl?
0
bergertimeAuthor Commented:
Not sure I understand?  Do I need to change my code above?
0
bergertimeAuthor Commented:
changed subNode.NavigateUrl = "WebDocuments/" & fi.Name.ToString()  to
subNode.NavigateUrl = "~/WebDocuments/" & node.text  & fi.Name.ToString()
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.