v4.1 Breadcrumb Issue

Posted by Community Admin on 03-Aug-2018 13:38

v4.1 Breadcrumb Issue

All Replies

Posted by Community Admin on 12-May-2011 00:00

Hi guys,

I'm posting here rather than opening a support ticket as I could do with a quick response and hopefully someone already has a solution.

I created a breadcrumb control using the sample code within the forum, since upgrading to 4.1 it no longer displays.

My code is as follows:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Breadcrumb.ascx.cs" Inherits="Controls_Breadcrumb" %>
<asp:SiteMapPath runat="server" ID="Breadcrumbs" RenderCurrentNodeAsLink="true" PathSeparator=" > "
    OnItemCreated="Breadcrumbs_ItemCreated" NodeStyle-Font-Bold="true" NodeStyle-Font-Size="12px"
    NodeStyle-ForeColor="#737373" CurrentNodeStyle-ForeColor="#1183dd" NodeStyle-Font-Underline="false"
    PathSeparatorStyle-Font-Bold="true" PathSeparatorStyle-Font-Size="10px" PathSeparatorStyle-ForeColor="#737373" CssClass="breadcrumbControl">
</asp:SiteMapPath>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class Controls_Breadcrumb : System.Web.UI.UserControl
    protected void Page_Load(object sender, EventArgs e)
    
 
    
 
    protected void Breadcrumbs_ItemCreated(object sender, SiteMapNodeItemEventArgs e)
    
        if ((e.Item.ItemIndex == 0) && (e.Item.ItemType == SiteMapNodeItemType.Root) && (e.Item.Controls.Count > 0))
        
            if (e.Item.Controls[0] is HyperLink)
            
                ((HyperLink)e.Item.Controls[0]).Text = "Home";
                ((HyperLink)e.Item.Controls[0]).ToolTip = "";
            
        
        else if (e.Item.ItemType == SiteMapNodeItemType.Current)
        
            if (e.Item.Controls[0] is Literal)
            
                Telerik.Sitefinity.Web.PageSiteNode pageSiteNode = (Telerik.Sitefinity.Web.PageSiteNode)e.Item.SiteMapNode;
                Telerik.Sitefinity.Modules.Pages.PageManager manager = new Telerik.Sitefinity.Modules.Pages.PageManager();
 
                Telerik.Sitefinity.Pages.Model.PageNode pageNode = manager.GetPageNode(pageSiteNode.Id);
 
                ((Literal)e.Item.Controls[0]).Text = pageNode.Title.Value;
            
        
    
 
 

Can anyone advise how to get it working again?

I have to admit I am really disappointed so far with Sitefinity 4 although the technical team have been very helpful, we have had to delay projects and with all the various bugs that were in it orginally, missing functionality from v3.7 and now all these new bugs in 4.1. We are starting to look bad in front of our clients and are also losing money spending time having to re-address issues.

Sitefinity looks head and shoulders above other CMS's out there with it's professional UI etc... but it just doesn't work correctly. We have two quotes with clients to build new systems using Sitefinity 4 but I am starting to regret basing them on SItefinity and have no option but to evaluate other CMS's with Umbraco and Drupal top of the list.

We have been using Telerik products for the past couple of years in our company and work with the RadControls daily which are great but Sitefinity 4 has been such a disappointment.

Hopefully things will improve shortly.
thanks
Richard

Posted by Community Admin on 12-May-2011 00:00

Hi Richard, welcome to Sitefinity 4x....

The SiteMapPath has been broken for a while now and no fix in sight...

http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/internal-build-sitemappath-and-radsitemap-not-working.aspx

Check that post for discussion on what I think is same issue.

Cheers,
Phill

Posted by Community Admin on 12-May-2011 00:00

Thanks Phill,

Looking in at the PITS it's said to be resolved although I can see your comment that it is still not working. Can someone from Telerik please comment to see if this is being looked into.

I can't understand why something so common which was previously in previous versions and something that is common on most sites has been missed out in the first place.

Posted by Community Admin on 13-May-2011 00:00

Hi,
I use this code and may help you.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Breadcrumb.ascx.cs" Inherits="SitefinityWebApp.Controls.Breadcrumbs" %>
 
<a href="/">Home</a> »
<asp:Repeater runat="server" ID="rep1">
 <ItemTemplate>
  <asp:HyperLink runat="server" ID="nodelink1" />
   <asp:Literal runat="server" ID="literalsep"></asp:Literal>
 </ItemTemplate>
</asp:Repeater>




using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Sitefinity.Web;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Modules.Pages.Configuration;
   
namespace SitefinityWebApp.Controls
     
    public partial class Breadcrumbs : System.Web.UI.UserControl
    
   
         
        protected override void OnInit(EventArgs e)
        
        
   
   
        protected void Page_Load(object sender, EventArgs e)
        
            var configManager = Config.GetManager();
            var config = configManager.GetSection<PagesConfig>();
            var id = config.HomePageId;
 
            var currentNode = SiteMapBase.GetActualCurrentNode();
            List<PageSiteNode> list = new List<PageSiteNode>();
            //list.Add(currentNode);
            if (currentNode.PageId != id) //homepage
            
                list.Add(currentNode);
            
 
            while (currentNode.ParentNode != null && currentNode.ParentNode.Title != "Pages")
            
                currentNode = currentNode.ParentNode as PageSiteNode;
                list.Add(currentNode);
            
            list.Reverse();
   
            rep1.DataSource = list;
            rep1.ItemDataBound += new RepeaterItemEventHandler(rep1_ItemDataBound);
            rep1.DataBind();
   
        
   
        void rep1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            
               var link = e.Item.FindControl("nodelink1") as HyperLink;
               var l = e.Item.FindControl("literalsep") as Literal;
               var node = e.Item.DataItem as PageSiteNode;
               link.Text = node.Title;
               link.NavigateUrl = node.Url;
               if (l != null)
               
                   l.Text = " » ";
               
                 
                 
            
        
   
         
    

Posted by Community Admin on 13-May-2011 00:00

Thanks mkavici, that works a treat. Much appreciated.

Posted by Community Admin on 26-May-2011 00:00

Excellent post just about to add a support ticket for no breadcrumb.

Should have taken advice and stayed with 3.7 also. 4.1 is much faster to develop the templating side but missing some core features that 3.7 had.

Posted by Community Admin on 27-May-2011 00:00

Thanks mkavici for sharing. Much appreciated. 

I'm trying to add the news/blog title to the end of this breadcrumbs plugin for the last few hours but still can't figure out. uggghh. Did anyone got that part to work and would like to share?



This thread is closed