Solved

sitemapnode

Posted on 2010-09-01
7
778 Views
Last Modified: 2012-05-10
Can you add a onclick function  in vb to a sitemapnode for each url
0
Comment
Question by:sevensnake77
  • 4
  • 2
7 Comments
 
LVL 16

Expert Comment

by:kris_per
ID: 33578336

Not sure if onclick function can be added to SiteMapNode....

But see if you can use SiteMapResolve event in code-behind for your requirement...

0
 
LVL 13

Expert Comment

by:Molnar István
ID: 33585185
i have found some code on this site: http://forums.asp.net/p/1404810/3068147.aspx

hope it helps
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 33618544
I seen that but i need vb version? I will try to convert it again but did not work out correctly.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Author Comment

by:sevensnake77
ID: 33618589
protected void SiteMapPath1_ItemCreated(object sender, SiteMapNodeItemEventArgs e)
    {        
if ((this.MasterJS != string.Empty) && (e.Item.ItemType !=
     SiteMapNodeItemType.PathSeparator) &&
(e.Item.ItemType != SiteMapNodeItemType.Current)
        {
            e.Item.Attributes.Add("onclick", this.MasterJS);
        }
else if (e.Item.ItemType == SiteMapNodeItemType.Current)
        {
            e.Item.Attributes.Add("onClick", "JavaScript: return false;");
        }

    }

can you convert this to vb, i need a class definitions and I do not know it for the above code.
0
 
LVL 13

Accepted Solution

by:
Molnar István earned 500 total points
ID: 33644154
usually i work in c# but you can convert the code from c# to vb with this online tool:
http://www.developerfusion.com/tools/convert/csharp-to-vb/

hope it helps

after i converted with the tool , the result is this:
Protected Sub SiteMapPath1_ItemCreated(sender As Object, e As SiteMapNodeItemEventArgs)
	If (Me.MasterJS <> String.Empty) AndAlso (e.Item.ItemType <> SiteMapNodeItemType.PathSeparator) AndAlso (e.Item.ItemType <> SiteMapNodeItemType.Current) Then
		e.Item.Attributes.Add("onclick", Me.MasterJS)
	ElseIf e.Item.ItemType = SiteMapNodeItemType.Current Then
		e.Item.Attributes.Add("onClick", "JavaScript: return false;")
	End If

End Sub

Open in new window

0
 
LVL 9

Author Comment

by:sevensnake77
ID: 33646246
I know the tool did not work for me, kept getting errors usually . Thanks
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 33693928
tks
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

12 Experts available now in Live!

Get 1:1 Help Now