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
Solved

asp.net breadcrums

Posted on 2011-09-06
10
296 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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 …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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