Solved

Why can't I find the node

Posted on 2014-02-26
9
149 Views
Last Modified: 2014-11-11
I have a need to change the navigate URL of a treenode depending on the user group.  Here is the code I am using to find the node.

Dim myNode As New TreeNode
Dim myTest As String = "Carpet/Vinyl Install Dates"
myNode = TreeView1.FindNode(Server.HtmlEncode(mytest))
myNode.NavigateUrl = "~/Inspections/frmInstallDates2.aspx"

Open in new window


When I look at the locals  I can see this.


treeview1.Nodes(6).ValuePath      "Carpet/Vinyl Install Dates"      String

Yet the code above does not find the node.  Any ideas.

thanks
0
Comment
Question by:mgmhicks
  • 4
  • 2
9 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39889138
Have you tried without the Server.HtmlEncode call?
0
 

Author Comment

by:mgmhicks
ID: 39889156
Isn't that what I am doing in the code I sent?

myNode = TreeView1.FindNode(Server.HtmlEncode(mytest))


If it helps this code is on a master page
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39889180
I am asking if you have removed that bit, and tried it simply as:

myNode = TreeView1.FindNode(mytest)

Open in new window

0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

Author Comment

by:mgmhicks
ID: 39889190
i'm sorry yea, that didn't work either.  Weird, cause node(6) has that valuepath
0
 

Accepted Solution

by:
mgmhicks earned 0 total points
ID: 39889319
this is what I ended up doing and this works.

 If mWaterford = True Then
                For Each myNode In TreeView1.Nodes
                    If myNode.ValuePath = "Carpet/Vinyl Install Dates" Then
                        myNode.NavigateUrl = "~/Inspections/frmInstallDates2.aspx"
                    Else
                    End If
                Next
            Else
                For Each myNode In TreeView1.Nodes
                    If myNode.ValuePath = "Carpet/Vinyl Install Dates" Then
                        myNode.NavigateUrl = "~/Inspections/frmInstallDates.aspx"
                    Else

                    End If
                Next
            End If
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39891844
I know you have got it working now but when you were trying to use FindNode, was PathSeparator property of the treeview set to "/"?
0
 

Author Comment

by:mgmhicks
ID: 39891862
yes it is set to "/"
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question