Solved

asp.net breadcrums

Posted on 2011-09-06
10
299 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
[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
  • 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
Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

 
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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 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