Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Why can't I find the node

Posted on 2014-02-26
9
Medium Priority
?
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Stressed Out?

Watch some penguins on the livecam!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

688 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