?
Solved

asp.net breadcrums

Posted on 2011-09-06
10
Medium Priority
?
300 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: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
  • 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:Seven price
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:Seven price
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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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:Seven price
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:Seven price
ID: 36491737
whats the declaration fo Handles SiteMapPath1.MenuItemDataBound

delare MenuItemDataBound
0
 
LVL 5

Accepted Solution

by:
zvytas earned 1500 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:Seven price
ID: 36542995
tks
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

777 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