views:

774

answers:

2

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>
A: 

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>
bendewey
This issue is I don't want Reports and MyReport on the same level, I want MyReport to show UNDER Report. I tried switching my sitemap structure to yours to see what happened differently once again it shows the structure as expected in the treeview but the sitemappath still doesn't display.
Chris Marisic
Whats your SiteMap DataSource look like. Try removing the DataSourceID all together from the SiteMapPath control. Its not required if you are using a root web.sitemap file.
bendewey
A: 

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.

rball