1

I am trying to hide the root level alone in the breadcrumb

<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"> 
<SharePointWebControls:ListSiteMapPath runat="server" SiteMapProviders="CurrentNavigation" 
 RenderCurrentNodeAsLink="false" ParentLevelsDisplayed="0"  /><br /> </asp:Content>

Now if i give ParentLevelsDisplayed=0, its showing only the current page in breadcrumb, if its 1 it is showing 1 parent and so on.

Now how can i remove only the root parent and show all other parents?

I.E If i have it like

Somesite -> Home -> Schools -> Montessori 

I want to display

Home -> Schools -> Montessori 
  • 1
    Try setting HideInteriorRootNodes = "false" if no success see if you can do something with RootNodeStyle – Naveen May 28 '15 at 13:19
  • tried HideInteriorRootNodes but no luck the root node is still coming – Vignesh Subramanian May 28 '15 at 13:24
  • is it possible to apply rootnodestyle only to the root element? – Vignesh Subramanian May 28 '15 at 13:36
  • Please apply some style to observe where it is taking affect. – Naveen May 28 '15 at 15:05
  • 1
    Are you fine with any JavaScript to hide it run time? – Asad Refai Jun 1 '15 at 10:29
1

If in case you are unable to find any OOB solution, and ready to use some jQuery then I think it can be achieved in below steps.

1. First surround your breadcrumb control in master page with a div container, this help in catching on run time.

Your Code

<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"> 
  <SharePointWebControls:ListSiteMapPath runat="server" SiteMapProviders="CurrentNavigation" RenderCurrentNodeAsLink="false" ParentLevelsDisplayed="0"  />
</asp:Content>

Suggestion in Code

<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"> 
  <div id="UniqueID">
    <SharePointWebControls:ListSiteMapPath runat="server" SiteMapProviders="CurrentNavigation" RenderCurrentNodeAsLink="false" ParentLevelsDisplayed="0"  />
  </div>
</asp:Content>

2. When you investigate your breadcrumb's rendered html using developer tool, it will be noticed that the breadcrumb is contained in span

<div id="UniqueID">
    <span id="ctl00_Sitemappath1" hideinteriorrootnodes="true" sitemapproviders="SPContentMapProvider">
        <a href="#ctl00_Sitemappath1_SkipLink">
            <img width="0" height="0" style="border-width: 0px;" alt="Skip Navigation Links src="/WebResource.axd?d=cgjLuuzo9laIDKrNp8K9dB_rjEQ2imaJ-OLdUpvi6j9SAwQkLmpz1KPsYL4jBzZx3s7Hhmd0ib4Sjv8Y8VX6IdQFPAEZR0BOJ9_cI-NuOoU1&amp;t=635201010537823876">
        </a>
        <span>
            <a title="Some title" href="/Pages/default.aspx">Some Site</a>
        </span>
        <span> 
            &gt; 
        </span>
        <span>
            <a title="Lorem ipsum dolor sit amet" href="/Some Site/Pages/default.aspx">Some Sub Site</a>
        </span>
        <span> 
            &gt; 
        </span>                                                                                                                                 
    </span>
</div>

Note: Since your are using ListSiteMapPath control, rendered html slightly be different.

3. If you would want to get rid of Somesite -> part of breadcrumb, then we can use below jQuery.

//hide Somesite
$("#UniqueID > span > span:first-child").css('display', 'none');
//hide >
$("#UniqueID > span > span:nth-child(2)").css('display', 'none');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.