Solved

Why can't I find the node

Posted on 2014-02-26
9
148 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now