Solved

asp.net breadcrums

Posted on 2011-09-06
10
293 Views
Last Modified: 2012-05-12
i HAVE  a dynamic database sql navigation for the breadcrums. Now some of the breadcrums are headers. How can I have those links, link to no where within the database or in my vb.net code itself.

the problem is If I have no url for the navigation that has no link then I get an error.

Multiple nodes with the same key '' were found. XmlSiteMapProvider requires that sitemap nodes have unique keys.
0
Comment
Question by:sevensnake77
  • 5
  • 4
10 Comments
 
LVL 5

Expert Comment

by:zvytas
ID: 36489656
You can achieve the desired behaviour by setting Selectable property to false, e.g.:

    protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
    {
          if (e.Item.Text == "Home")
        {
                      e.Item.Selectable = false;
        }
    }
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 36489721
Protected Sub WebDataMenu1_MenuItemDataBound(ByVal sender As Object, ByVal e As MenuEventArgs)
        Dim siteMapNode As SiteMapNode = DirectCast(e.Item.DataItem, SiteMapNode)

        Dim visable As String = siteMapNode("visable")
        If Not String.IsNullOrEmpty(visable) AndAlso Not Boolean.Parse(visable) Then
            e.Item.ChildItems.Clear()
        End If
        If e.Item.Text = "HOME" Then
            e.Item.Selectable = False
        End If

    End Sub

does not seem to work
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 36489749
maybe that was confusting

<asp:SiteMapPath ID="SiteMapPath1"  CssClass="navBread"  RenderCurrentNodeAsLink="True"
    runat="server" >
    <PathSeparatorStyle Font-Bold="True" ForeColor="#507CD1" />
    <CurrentNodeStyle ForeColor="#333333" />
    <NodeStyle Font-Bold="True" ForeColor="#284E98" />
    <RootNodeStyle Font-Bold="True" ForeColor="#507CD1" />
</asp:SiteMapPath>
0
 
LVL 5

Expert Comment

by:zvytas
ID: 36489803
Your event handler is as follows:

Protected Sub WebDataMenu1_MenuItemDataBound

However ID of the menu control is SiteMapPath1. Event handler name should be SiteMapPath1_MenuItemDataBound.
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 36489850
 Protected Sub SiteMapPath1_MenuItemDataBound(ByVal sender As Object, ByVal e As MenuEventArgs)
        If e.Item.Text = "MAIN" Then
            e.Item.Selectable = False
            Response.Write("tt")
        Else
            e.Item.Selectable = True
            Response.Write("AA")
        End If
    End Sub

yes I know. Thanks but some reason i am not getting any response.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 28

Expert Comment

by:strickdd
ID: 36490129
One of the "old school" tricks is to simly link to the hash tag: <a href="#"></a>. so you should be able to use that as your navigation destination.
0
 
LVL 5

Expert Comment

by:zvytas
ID: 36490866
I assume AutoEventWireup is turned off on your page, please add "handles" at the end of the method definition:

Protected Sub SiteMapPath1_MenuItemDataBound(ByVal sender As Object, ByVal e As MenuEventArgs) Handles SiteMapPath1.MenuItemDataBound
0
 
LVL 9

Author Comment

by:sevensnake77
ID: 36491737
whats the declaration fo Handles SiteMapPath1.MenuItemDataBound

delare MenuItemDataBound
0
 
LVL 5

Accepted Solution

by:
zvytas earned 500 total points
ID: 36491815
Protected Sub SiteMapPath1_MenuItemDataBound(ByVal sender As Object, ByVal e As MenuEventArgs) Handles SiteMapPath1.ItemDataBound
        If e.Item.Text = "MAIN" Then
            e.Item.Selectable = False
            Response.Write("tt")
        Else
            e.Item.Selectable = True
            Response.Write("AA")
        End If
    End Sub
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 36542995
tks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

19 Experts available now in Live!

Get 1:1 Help Now