1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / BreadCrumb Issues

BreadCrumb Issues

2 posts, 0 answered
  1. Inna Young
    Inna Young avatar
    8 posts
    Registered:
    21 Jul 2009
    16 Nov 2009
    Link to this post
    Hello,

    How can I make theBreadCrumb not to display the navigation item on a parent (node, first) page? For example, on this page http://web1.annapolis.gov/Government.aspx I have a first item of the nav. displayed (Government). How do I make it disappear? I need it to start appearing on the secondary pages.

    thank you

    inna


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    17 Nov 2009
    Link to this post
    Hi Inna Young,

    You can create a custom control that inherits from Breadcrumb class and hide the items for which Parent is equal to null.

    Sample code:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Cms.Web.UI;
    using Telerik.Cms.Web;
    using Telerik;
    using System.Web.UI.WebControls;
    using Telerik.Cms;
     
    /// <summary>
    /// Summary description for Class3
    /// </summary>
    public class Class3 : Breadcrumb
    {
        public Class3()
        {
        }
     
        public bool HideParent
        {
            get
            {
                return this.hideParent;
            }
            set
            {
                this.hideParent = value;
            }
        }
        private bool hideParent = false;
     
        protected override void InitializeItem(System.Web.UI.WebControls.SiteMapNodeItem item)
        {
            if (HideParent)
            {
                CmsSiteMapNode currentNode = SiteMap.CurrentNode as CmsSiteMapNode;
                if (currentNode != null && currentNode.Parent == null)
                {
                    item.Visible = false;
                }
                 
            }
            base.InitializeItem(item);
     
        }
    }

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered