Quantcast
Channel: Coding - John Chapman
Viewing all articles
Browse latest Browse all 23

[SharePoint 2013] Restore the Breadcrumb (Navigate Up) Navigation

$
0
0

Update: I have packaged this solution up in a SharePoint solution. You can get the packaged solution and the source code here: [SharePoint 2013] Restore the Breadcrumb (Navigate Up) Navigation Part 2.


SharePoint 2010 had a breadcrumb feature on the ribbon that would let a user navigate up the breadcrumb. In SharePoint 2013, this feature is hidden. In SharePoint 2013 the breadcrumb feature can be made visible again in at least two different ways: 1) via the Master Page -or- 2) via code.

Breadcrumb in SharePoint 2010:

NavigateUp2010

Breadcrumb made visible in SharePoint 2013:

NavigateUp2013

Using the Master Page

To make the breadcrumb visable by editing the Master Page, open the Master Page in SharePoint Designer. Edit the following block of code to remove display:none from the containing DIV and visible=false from the breadcrumb control.

Old Code:

[xml]<div class="ms-breadcrumb-dropdownBox" style="display:none;">
<SharePoint:AjaxDelta id="DeltaBreadcrumbDropdown" runat="server">
<SharePoint:PopoutMenu
Visible="false"
runat="server"[/xml]

New Code:

[xml]<div class="ms-breadcrumb-dropdownBox">
<SharePoint:AjaxDelta id="DeltaBreadcrumbDropdown" runat="server">
<SharePoint:PopoutMenu
runat="server"[/xml]

Using Code

To make the breadcrumb visible on every page from code, I recommend using an AdditionalPageHead delegate control (see https://www.johnchapman.net/sharepoint-2010-programmatically-add-javascript-meta-tags-and-css-styles-to-the-header-of-every-page/). In the AdditionalPageHead user control, the following code will make the control visible as well as fix the icon not showing under certain themes:

[csharp]protected override void CreateChildControls()
{
var masterPage = this.Page.Master;
var delta = masterPage.FindControl("DeltaBreadcrumbDropdown") as AjaxDelta;
if (delta != null)
{
var breadcrumb = delta.FindControl("GlobalBreadCrumbNavPopout") as PopoutMenu;
if (breadcrumb != null)
{
breadcrumb.Visible = true;
breadcrumb.ThemeKey = "spcommon";
breadcrumb.IconUrl = "/_layouts/15/images/spcommon.png";
this.Controls.Add(new LiteralControl("<style type="text/css">.ms-breadcrumb-dropdownBox { display: inline-block !important; }</script>"));
}
}
base.CreateChildControls();
}[/csharp]


Viewing all articles
Browse latest Browse all 23

Trending Articles