Control Panel: Automatic breadcrumb

Control Panel: Automatic breadcrumb

February 26, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]


Similarly to the automatic command generation, base Control Panel also provides built-in breadcrumb that is automatically generated from the given View hierarchy.


The breadcrumb will take the title of the View as the text of the node, while the command will be generated automatically for you. Let us take a look at one such sample of the automatic breadcrumb.



Hiding the breadcrumb

Automatic breadcrumb is the built in feature of the base Control Panel class and it was not meant to be removed. However, it is possible to hide the breadcrumb, just as it is possible to alter the Control Panel in any other way. In order to this, we will map the embedded template for the Control Panel and alter it. To do so, follow these steps:


Create a Control Panel template


  • Navigate to this folder in your Sitefinity website: ~/Sitefinity/Admin/ControlTemplates/Common
  • Add new User Control to that folder and name it ControlPanel.ascx (do not mark “Put code in separate file” checkbox)
  • Paste following markup in the file (this is the structure of the embedded Control Panel template):
    <%@ Control Language="C#" %> 
    <%@ Register TagPrefix="sf" Namespace="Telerik.Cms.Web.UI.Backend" Assembly="Telerik.Cms.Web.UI" %> 
    <sf:BackendBreadcrumb CssClass="ContorlPanelTitle" CurrentItemCssClass="currentBCItem" ID="breadcrumb" runat="server"></sf:BackendBreadcrumb> 
    <asp:PlaceHolder ID="controlPanelView" runat="server"></asp:PlaceHolder> 
  • Save the file.
Next thing we need to do is determine for which module we wish to hide the breadcrumb. Let us assume we have decided not to display the breadcrumb in the news module, so that our news module looks something like this:

Next step is to map the Control Panel template of the news module to an external template, the one we have defined few moments earlier. To do so we will paste following declaration in our Controls Config file (click here to learn more about template mappings): 


<!--This template defines the layout of the Control Panel for all backend modules.--> 
    <viewSettings hostType="Telerik.News.WebControls.Admin.NewsControlPanel" 
                  layoutTemplatePath="~/Sitefinity/Admin/ControlTemplates/Common/ControlPanel.ascx" /> 


*** IMPORTANT *** 


Every time you modify ControlsConfig file it is necessary to restart the application in order for the changes to be applied. While there are numerous ways to restart an application, here are few handy ones - you can restart the IIS server, resave web.config file (e.g. open web.config file, press space, press backspace, save config.file), resave global.asax file (e.g. open global.asax file, press space, press backspace, save global.asax file)… 




Now, that we have mapped the NewsControlPanel to an external template all we are left with is to hide the Breadcrumb control.


To do so we will open the template file we’ve created at the beginning of this tutorial and placed in ~/Sitefinity/Admin/ControlTemplates/Common/ControlPanel.ascx and modify it to look like this:


<%@ Control Language="C#" %> 
<%@ Register TagPrefix="sf" Namespace="Telerik.Cms.Web.UI.Backend" Assembly="Telerik.Cms.Web.UI" %> 
<div style="display:none;"
    <sf:BackendBreadcrumb CssClass="ContorlPanelTitle" CurrentItemCssClass="currentBCItem" ID="breadcrumb" runat="server"></sf:BackendBreadcrumb> 
<asp:PlaceHolder ID="controlPanelView" runat="server"></asp:PlaceHolder> 


*** NOTE ***


BackendBreadcrumb control is defined as required control on the Control Panel class, so we cannot simply delete it. The workaround for this is to hide it with CSS.


*** END NOTE ***


The Progress Guys

View all posts from The Progress Guys on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments are disabled in preview mode.
Latest Stories in
Your Inbox
More From Progress
5 Questions Automakers Should Ask to Improve Asset Uptime
Download Whitepaper
2018 Gartner Magic Quadrant Web Content Management (WCM)
Download Whitepaper
What Serverless Means for Enterprise Apps
Watch Webinar