Solved

Why can't I find the node

Posted on 2014-02-26
9
151 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
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!

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Set DateTime format for a SEP Date Control Object 2 15
modifying VBScript to VBA 17 74
Regarding swagger API 1 38
VB script help 23 36
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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