Solved

sitemapnode

Posted on 2010-09-01
7
792 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
[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
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
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…

752 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