Friday, October 23, 2009

How To: BreadCrumb to show sub folders in Document Library


Usually, you cannot see the breadcrumb for the Sub folders which are stored in the Document Library. You can see the Breadcrumb links only up to Parent folder (i.e. document library).

So, how to modify the breadcrumb to show the Sub folders too?. 

Well.. 

1. Open SharePoint Desigenr 2007
2. Open that specific web site
3. Go to that document library. Inside you can see a folder with the name of "Forms".
4. Double click to open it. 
5. Double click on "AllItems.aspx" file.
6. Within that source, you can see the below code. sometime, the below code will not be available. If the code is not available, add the below code in between any of the 2 Content blocks.


<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server">
<div class="breadcrumb">
<asp:SiteMapPath ID="siteMapPath1" Runat="server" SiteMapProvider="CurrentNavSiteMapProviderNoEncode"
RenderCurrentNodeAsLink="false" SkipLinkText="" CurrentNodeStyle-CssClass="breadcrumbCurrent" NodeStyle-CssClass="ms-sitemapdirectional"/>
</div>
</asp:Content>


7. Change the SiteMapProvider value as "SPContentMapProvider" instead of "CurrentNavSiteMapProviderNoEncode"

See the Sample Code below:
<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server">
<div class="breadcrumb">
<asp:SiteMapPath ID="siteMapPath1" Runat="server" SiteMapProvider="SPContentMapProvider"
RenderCurrentNodeAsLink="false" SkipLinkText="" CurrentNodeStyle-CssClass="breadcrumbCurrent" NodeStyle-CssClass="ms-sitemapdirectional"/>
</div>

See the  below sample result page:



Good luck...

1 comment: