Solved

asp.net breadcrums

Posted on 2011-09-06
10
297 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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