Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity: General Discussions > Breadcrumb for 4.3.1885.0

Breadcrumb for 4.3.1885.0

  • Chris avatar

    Posted on Jan 17, 2012 (permalink)

    So this isn't frustrating at all :)  We have version 4.3.1885.0 and I tried downloading and installing this module and it broke the site.  Come to find out, that module is specific to 4.3.1873.0.  So I have two questions:

    1) is there a breadcrumb widget, or some sort of way to create a breadcrumb without manually adding it on ever page?  Basically I just want it to be home > news > (title of news article).  or if it's not under a parent page I want it to be home > (title of page).

    2) what changed from 4.3.1885.0 to 4.3.1873.0 that it causes the big error?  Is there a way to modify that code to make it work?

    Reply

  • Posted on Jan 18, 2012 (permalink)

    Hi Chris,
    This is indeed a pain, it seems that with every SF update it takes almost a month for the control to be updated. Since it's a free control it'd be nice if they just released the source so we could build it with our projects and keep it up to date, or even better Telerik could add this basic functionality to their menu widget.
    Anyway, the easiest solution I've found, other than just waiting longer is to do the assembly binding in your web.config. Try adding the following just before the </configuration> tag (thanks to Jim in the module comments for this fix).
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Telerik.Sitefinity" publicKeyToken="b28c218413bdf563" />
                <bindingRedirect oldVersion="4.3.1873.0" newVersion="4.3.1885.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Telerik.Sitefinity.Model" publicKeyToken="b28c218413bdf563" />
                <bindingRedirect oldVersion="4.3.1873.0" newVersion="4.3.1885.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Telerik.Sitefinity.Utilities" publicKeyToken="b28c218413bdf563" />
                <bindingRedirect oldVersion="4.3.1873.0" newVersion="4.3.1885.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>

    The reason it breaks is that the custom module is compiled using the Telerik.Sitefinity dlls specific to that version and the module dll then expects those dlls to be available. The above config maps the old dll version to the new one so things should work. 

    Hope that helps.
    Regards,
    Phill

    Reply

  • Chris avatar

    Posted on Jan 18, 2012 (permalink)

    Hey Phill,
    Unfortunately I am getting the following error:

    Type cannot be resolved

    Any ideas of what's going on?  Sorry for the novice level of knowledge with Sitefinity, definite n00b here.  Any help is greatly appreciated.

    Thanks,
    Chris

    Reply

  • Posted on Feb 8, 2012 (permalink)

    Hi,
    I made my own breadcrumb and it works since 4.0 version. But it's really simple

    ascx :
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SiteMapPath.ascx.cs"
        Inherits="SitefinityWebApp.CustomComponent.SiteMapPath" %>
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" RenderCurrentNodeAsLink="True" OnItemCreated="SiteMapPath1_ItemCreated">
        <RootNodeTemplate>
            <asp:HyperLink runat="server" ID="RootNodeItem"></asp:HyperLink>
        </RootNodeTemplate>
    </asp:SiteMapPath>

    cs :
    using System;
    using System.Linq;
    using System.Text;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Sitefinity;
     
    namespace SitefinityWebApp.CustomComponent
    {
        public partial class SiteMapPath : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
            }
     
            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
                SiteMapPath1.SkipLinkText = String.Empty;
                SiteMapPath1.CssClass = CssClass;
                SiteMapPath1.ItemCreated += new SiteMapNodeItemEventHandler(SiteMapPath1_ItemCreated);
            }
     
            [CssClassProperty]
            public string CssClass
            { get; set; }
     
            protected void SiteMapPath1_ItemCreated(object sender, SiteMapNodeItemEventArgs e)
            {
                if (e.Item.ItemType == SiteMapNodeItemType.PathSeparator)
                    e.Item.CssClass = CssClass + "Separator";
                else
                    e.Item.CssClass = CssClass + "Link";
     
                if (e.Item.ItemType == SiteMapNodeItemType.Root)
                {
                    using (var sf = App.WorkWith())
                    {
                        var pageP = sf.Page().PageManager.GetPageNode(((Telerik.Sitefinity.Web.PageSiteNode)e.Item.SiteMapNode).Id);
     
                        var pageRoot = pageP.Nodes.Where(pChild => pChild .Ordinal == 1.0).SingleOrDefault();
     
                        HyperLink rootNode = e.Item.FindControl("RootNodeItem") as HyperLink;
     
                        if (pageRoot != null)
                        {
                            StringBuilder urlDest = new StringBuilder();
                             
                            urlDest.Append(e.Item.SiteMapNode.Url);
                            urlDest.Append(pageRoot.Title.CurrentLanguage.TwoLetterISOLanguageName);
                            urlDest.Append("/");
                            urlDest.Append(pageRoot.UrlName);
     
                            rootNode.NavigateUrl = urlDest.ToString();
                            rootNode.Text = pageRoot.Title.Value;
                        }
                    }
                }
            }
     
        }
    }

    Identify page with "pChild => pChild .Ordinal == 1.0" it's not the best way you just have to change it.

    Regards,
    Nicolas

    Reply

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity: General Discussions > Breadcrumb for 4.3.1885.0