Solved

sitemapnode

Posted on 2010-09-01
7
794 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
[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: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
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

 
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 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: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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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 video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

627 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