Solved

sitemapnode

Posted on 2010-09-01
7
788 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 our DevOps Teams Maximize Uptime

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

 
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

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.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…

828 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