More in this section

Forums / Developing with Sitefinity / how to show title to the breadcrumb link?

how to show title to the breadcrumb link?

8 posts, 0 answered
  1. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    08 Jun 2010
    Link to this post
    Hi,

    can it be possible to have title/tooltip for the breadcrumb hyperlink control?..how can i achieve this through code?

    Thanks,
    sathiya
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    08 Jun 2010
    Link to this post
    Hello sathiyaseelan,

    You can try with a control which inherits from ours. Here is sample code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Cms.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Cms.Web;
    using Telerik;
    using System.ComponentModel;
     
    /// <summary>
    /// Summary description for CustomBreadCrumb
    /// </summary>
    public class CustomBreadCrumb: Breadcrumb, IEmptyControl
    {
        protected override void InitializeItem(System.Web.UI.WebControls.SiteMapNodeItem item)
        {
            base.InitializeItem(item);
            if (item.ItemType == SiteMapNodeItemType.Current)
            {
                item.ToolTip = ((CmsSiteMapNode)item.SiteMapNode).GetCmsPage().Title;
            }
        }
     
        #region IEmptyControl Members
     
        [Browsable(false)]
        public bool IsEmpty
        {
            get
            {
                return this.DesignMode;
            }
        }
     
        public string SetEmptyControlDefaultMessage()
        {
            return "The control cannot be rendered in design mode.";
        }
     
        #endregion
    }


    Sincerely yours,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    08 Jun 2010
    Link to this post
    Hi sir,

    can you explain me where i need to copy this code to. I am using sitefinity 3.7 version. Is it i need to create a user control and copy this code or how to do it.

    pls advice as am new to this.

    Thanks,
    sathiya
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    08 Jun 2010
    Link to this post
    Hello sathiyaseelan,

    This is a custom control. For more information on how to create custom controls, please take a look at this webinar: Extending Toolbox with New Controls.

    Greetings,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    08 Jun 2010
    Link to this post
    Hi sir,

    I am new to this. can you pls explain us briefly.

    Thanks,
    sathiya
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    08 Jun 2010
    Link to this post
    Hi sathiyaseelan,

    Add the class in App_Code folder.
    Add the following line in your web.config

    <toolboxControls
        <clear />
         <add name="CustomBreadCrumb" section="Navigation" type="CustomBreadCrumb, App_Code"/>

    Then you will be able to drag/drop the control on your page. The control will be accessible from the Toolbox >> Navigation section when you open a page for editing.


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    08 Jun 2010
    Link to this post
    Hi sir,

    Thanks i got it, and did the same.

    I got following error while saving the control in template.

     

     

     

    Server Error in '/' Application.

    Unable to cast object of type 'System.Web.SiteMapNode' to type 'Telerik.Cms.Web.CmsSiteMapNode'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.SiteMapNode' to type 'Telerik.Cms.Web.CmsSiteMapNode'.

    Source Error:

    Line 25:         if (item.ItemType == SiteMapNodeItemType.Current)
    Line 26:         {
    Line 27: item.ToolTip = ((CmsSiteMapNode)item.SiteMapNode).GetCmsPage().Title;Line 28:         }
    Line 29:     }


    Any idea's pls...

    Thanks,
    sathiya
  8. sathiyaseelan
    sathiyaseelan avatar
    82 posts
    Registered:
    26 Aug 2008
    08 Jun 2010
    Link to this post
    Hi sir,

    I got the solution...

     

    if (item.ItemType == SiteMapNodeItemType.Parent)

     

    {

    item.ToolTip = item.SiteMapNode.Title.ToString();

    }



    Thanks,
    sathiya
Register for webinar
8 posts, 0 answered