Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to add breadcrumbs on my web pages for easy navigation. For this I am using SiteMapPath Control of Asp.Net and along with this I have also made a breadcrumb.Sitemap file which list all the pages. But While implementing the sitemappath in my master page, I am getting a generic error. I am not able to understand why is this happening?
This is the basic structure of my aspx page-
ASP.NET
<div id="menu-pt">
<div class="hm"><a href="Page1.aspx" class="active">Home</a></div>
<div id="nav">
<ul id="nav" name="nav">
            	<li><a href="Page2.aspx">Page2</a></li>
                <div class="saparation"></div>
                <li><a href="Page3.aspx">Page3</a></li>
                <div class="saparation"></div>
             <li> <a href="Page4.aspx">Page4</a></li>
			<div class="saparation"></div>
            <li><a href="#">Pages</a>
            <div id ="Ul2" runat="server">
                <ul id="sub-nav" >
                <li><a href="Page5.aspx">Page5</a></li>
         		<li><a href="Page6.aspx">Page6</a></li>
          		<li><a href="Page7.aspx">Page7</a></li>
          		<li><a href="Page8.aspx">Page8</a></li>
            </ul>
            </div>
             <div id ="Ul1"  runat="server">
             <ul id="sub-nav" >
             
                <li><a href="Page9.aspx">Page9</a></li>
         		<li><a href="Page10.aspx">Page10</a></li>
         		<li><a href="Page11.aspx">Page11</a></li>
          		<li><a href="Page12.aspx">Page12</a></li>
          		<li><a href="Page13.aspx">Page13</a></li>
            </ul>
            </div>
                </li>          
		   </ul>
</div>
</div>

  • Page5,6,7,8.aspx pages is for all users. And
    • Page9,10,11,12,13.aspx pages are for logged in user.
      And My breadcrumb.sitemap file is-
      XML
      <?xml version="1.0" encoding="utf-8" ?>
      <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
          <siteMapNode url="Page1.aspx" title="Home"  description="Page1">
              <siteMapNode url="Page2.aspx" title="Page2"  description="Page2" />
              <siteMapNode url="Page3.aspx" title="Page3"  description="Page3" />
            <siteMapNode url="Page4.aspx" title="Page4"  description="Page4" />
            <siteMapNode url="" title="Pages"  description="">
              <siteMapNode url="Page5.aspx" title="Page5"  description="Page5" />
              <siteMapNode url="Page6.aspx" title="Page6"  description="Page6" />
              <siteMapNode url="Page7.aspx" title="Page7"  description="Page7" />
              <siteMapNode url="Page8.aspx" title="Page8"  description="Page8" />
              <siteMapNode url="Page9.aspx" title="Page9"  description="Page9" />
              <siteMapNode url="Page10.aspx" title="Page10"  description="Page10" />
              <siteMapNode url="Page11.aspx" title="Page11"  description="Page11" />
              <siteMapNode url="Page12.aspx" title="Page12"  description="Page12" />
              <siteMapNode url="Page13.aspx" title="Page13"  description="Page13" />
            </siteMapNode>
          </siteMapNode>
      </siteMap>

      Also I have placed a sitemappath control on my Master page-
      <asp:SiteMapPath ID="SiteMapPath1" runat="server">
      Please guide me where I am doing wrong. I read few articles and it says that this much of step is enough for adding breadcrumbs on every pages of a web site.
      Please Guide me where I am doing Wrong?
Posted
Comments
Richard Deeming 5-Mar-14 5:19am    
You'll need to post the details of the error before anyone can help you. "A generic error" isn't enough information to go on! :)
AshOmi 5-Mar-14 5:39am    
Hello,
Ok, Please clear one of doubt. Since I am using this sitemappath control in my master page, So where do I need to place this sitemappath control?
In contentplaceholder1 or contentplaceholder2???
Richard Deeming 5-Mar-14 5:45am    
If you're putting the control in the master page, and you put it inside a ContentPlaceholder control, it will only appear if the page doesn't include a corresponding Content control. Since you want the breadcrumbs to appear on every page, you should put the SiteMapPath control outside of any ContentPlaceholder.

As to *where* you put it, that depends on the layout of your site. You put it wherever you want the generated markup to appear in your page.
AshOmi 5-Mar-14 6:16am    
Actually I tried to put the sitemappath control inside the contentplaceholder of the master page, and then tested the file, By doing this I was not getting any error but also There was no breadcrumbs on my web page. But once I put this sitemappath control out side any of the contentplaceholder, I start getting error."Generic Error".
Richard Deeming 5-Mar-14 6:32am    
So we come back to my original comment - post the full details of the error. If the ASP.NET error page isn't displaying the full details, try looking in the application event log on the server.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900