Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

sitemapnode

Posted on 2010-09-01
7
Medium Priority
?
801 Views
Last Modified: 2012-05-10
Can you add a onclick function  in vb to a sitemapnode for each url
0
Comment
Question by:Seven price
  • 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:Seven price
ID: 33618544
I seen that but i need vb version? I will try to convert it again but did not work out correctly.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 9

Author Comment

by:Seven price
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 2000 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:Seven price
ID: 33646246
I know the tool did not work for me, kept getting errors usually . Thanks
0
 
LVL 9

Author Closing Comment

by:Seven price
ID: 33693928
tks
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

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…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

916 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