SiteMapPath Disappears on sub page

For some reason on my page my SiteMapPath disappears.

Site structure:

WebApp
-Default.aspx
-> Reports\
----Default.aspx
----MyReport.aspx

Web.sitemap

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/Default.aspx" title="Overview"  description="Overview">
    <siteMapNode url="~/Reports/Default.aspx" title="Reports"  description="Reports" >
      <siteMapNode url="~/Reports/MyReport.aspx" title="MyReport"  description="MyReport" />
    </siteMapNode>
  </siteMapNode>
</siteMap>

The SiteMapPath will display when I'm on the overview page of the reports page but not the MyReport page. With the sitemap bound to a treeview I see all of my nodes correctly.

Works - shows me on MyReport Page

<asp:TreeView ID="TreeView1" runat="Server" DataSourceID="SitePathDataSource">
</asp:TreeView>

Disappears on MyReport Page but visible on all others

<asp:SiteMapPath ID="SiteMapPath1" runat="server" DataSourceID="SitePathDataSource">
</asp:SiteMapPath>

Answers


I'm not exactly an expert on this. I did just test it on my pages and it worked fine. The only difference between what I am doing and yours is I am not specifying a filename on the parent node. Although I kind of stumbled into that one because I couldn't have the same path twice in my sitemap.

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >  
    <siteMapNode url="~/Default.aspx" title="Overview"  description="Overview">   
    	<siteMapNode url="~/Reports/" title="Reports"  description="Reports" >      
    		<siteMapNode url="~/Reports/Default.aspx" title="Reports Home"  description="Home" />
    		<siteMapNode url="~/Reports/MyReport.aspx" title="MyReport"  description="MyReport" />    
    	</siteMapNode>  
    </siteMapNode>
</siteMap>

What is the URL in your browser when the control is not displayed? I'd bet that you have a querystring value or something that does not match Reports/Myreport.aspx. If the path of the page does not match an item exactly in the sitemapnode it won't display.


Assign sitemap provider in page_load of page

SiteMapPath1.SiteMapProvider = "DefaultSiteMap"

inside web.config

    <siteMap defaultProvider="DefaultSiteMap" enabled="true">
<providers>
<add name="DefaultSiteMap" type="System.Web.XmlSiteMapProvider" siteMapFile="~\SiteMaps
\Default.sitemap" />
</providers>


Need Your Help

Secure $_GET & mysql usage?

php mysql

So I am trying to make some sort of page with stories for example

UIScrollView Stop working after push view to UINavigationController

ios uiscrollview uinavigationcontroller

The scrollview in my main page stop working if I push something to the navigation controller and then pop back to the main page. It works normally if I reopen the application without pushing anythi...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.