SiteMapPath Control and ShowStartingNode="False" Behavior

Last post 02-01-2009 4:12 PM by KelseyThornton. 2 replies.

Sort Posts:

  • SiteMapPath Control and ShowStartingNode="False" Behavior

    08-06-2006, 10:13 PM

    I am having trouble implementing both a standard left hand navigation using a treeview bound to a SiteMapDataSource and "breadcrumb" navigation at the Matser page level using a single site map file. In my site map I have a logical "Home" section which includes pages at the root level of the site such as "About Us" and "Contact Us." This scheme works just fine for the left hand navigation because I can specify that the starting all encompassing node in my site map file should not be pulled by my SiteMapDataSource. The starting node is a also titled "Home," but this is an arbitrary choice to meet the site map file requirement of one all encompassing SiteMapNode after the xml root SiteMap node. I do not consider this a logical section of my site, unless you view it as the section containing the whole site. The problem is in the breadcrumbs. Whenever I navigate to a page under the "Home" section I end up with two "Home" breadcrumbs (i.e. Home > Home > About Us). I've read one approach to resolving this issue, but it seemed a little convuluted. Is there some simple setting I am missing that will allow the SiteMapPath server control to ingore the starting node like you can with a SiteMapDataSource and Treeview?

    Thanks For Any Assistance

    Here is a stripped version of my sitemap:

    
    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
        <siteMapNode url="~/" title="Home"  description="Home">
    		<siteMapNode url="~/Default.aspx" title="Home"  description="Home Page">
    			<siteMapNode url="~/AboutUs.aspx" title="About Us"  description="About Us" />
    		</siteMapNode>
    		<siteMapNode url="~/Design/Default.aspx" title="Design"  description="Design A Home">
    			<siteMapNode url="~/Design/Collection/Default.aspx" title="Collection"  description="Choose Design From A Collection" />
    			<siteMapNode url="~/Design/Custom/Default.aspx" title="Custom"  description="Create A Unique Design" />
    		</siteMapNode>
          </siteMapNode>
    </siteMap>
     
  • Re: SiteMapPath Control and ShowStartingNode="False" Behavior

    04-26-2008, 5:24 AM
    • Member
      34 point Member
    • yupinggang
    • Member since 04-20-2008, 8:11 AM
    • Singapore
    • Posts 12

    What about setting the first SiteMapNode's url, title, and description to empty string?

     

    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="" title="" description="">
    <siteMapNode url="~/Default.aspx" title="Home" description="Home Page">
    <siteMapNode url="~/AboutUs.aspx" title="About Us" description="About Us" />
    </siteMapNode>
    <siteMapNode url="~/Design/Default.aspx" title="Design" description="Design A Home">
    <siteMapNode url="~/Design/Collection/Default.aspx" title="Collection" description="Choose Design From A Collection" />
    <siteMapNode url="~/Design/Custom/Default.aspx" title="Custom" description="Create A Unique Design" />
    </siteMapNode>
    </siteMapNode>
    </siteMap>
      
  • Re: SiteMapPath Control and ShowStartingNode="False" Behavior

    02-01-2009, 4:12 PM
    • Participant
      890 point Participant
    • KelseyThornton
    • Member since 07-15-2007, 8:01 AM
    • Breda, The Netherlands
    • Posts 230

    Seems to me like your sitemap should be as follows:

     

    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="~/Default.aspx" title="Home" description="Home Page">
    <siteMapNode url="~/AboutUs.aspx" title="About Us" description="About Us" />
    <siteMapNode url="~/Design/Default.aspx" title="Design" description="Design A Home">
    <siteMapNode url="~/Design/Collection/Default.aspx" title="Collection" description="Choose Design From A Collection" />
    <siteMapNode url="~/Design/Custom/Default.aspx" title="Custom" description="Create A Unique Design" />
    </siteMapNode>
    </siteMapNode>
    </siteMap>
     
    Kelsey Thornton
    (In the Netherlands)

    Don't forget - Mark the post which answered your question with "Answer", then that user will get some kudos, and your post will be marked as "Answered" for future readers!

    (VB code examples preferred)
Page 1 of 1 (3 items)