Breadcrumbs - Remove Last Link

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
webmaz
Lieutenant (LT)
Lieutenant (LT)
Posts: 52
Joined: Wed Apr 14, 2010 3:57 pm

Breadcrumbs - Remove Last Link

Post by webmaz » Tue Jan 18, 2011 3:21 pm

Hello,
Based on the information provided on the post below, I have successfully been able to change the look of the last breadcrumb (the current page).
viewtopic.php?f=44&t=14220&p=61111&hilit=breadcrumbs#p61111

Now, I'd like to remove the link from the last category displayed (the current category).
How I can make the last breadcrumb not a link?

Example:
Breadcrumb: Home > Toys for Girls > Dolls
Desired outcome: "Dolls" is not a link

Thanks!

User avatar
s_ismail
Commander (CMDR)
Commander (CMDR)
Posts: 162
Joined: Mon Nov 09, 2009 12:20 am
Contact:

Re: Breadcrumbs - Remove Last Link

Post by s_ismail » Mon Feb 07, 2011 10:53 am

Give a try by this code

In CategoryBreadCrumbs.ascx replace ItemTemplate with this one

Code: Select all

 <ItemTemplate>
            <asp:HyperLink ID="BreadCrumbsLink" runat="server" NavigateUrl='<%#UrlGenerator.GetBrowseUrl((int)Eval("catalogNodeId"), (string)Eval("name"))%>'
                Text='<%#Eval("Name")%>' Visible='<%# !IsLastItem() %>'></asp:HyperLink>
            <asp:Label ID="LastCategoryBreadCrumbItem" Visible='<%# IsLastItem() %>' runat="server"
                Text='<%#Eval("Name")%>'></asp:Label>
        </ItemTemplate>
and add this function in CategoryBreadCrumbs.ascx.cs

Code: Select all

int i = 0;    
    protected bool IsLastItem()
    {
        i++;
        return (i == (BreadCrumbsRepeater.Items.Count));
    }

webmaz
Lieutenant (LT)
Lieutenant (LT)
Posts: 52
Joined: Wed Apr 14, 2010 3:57 pm

Re: Breadcrumbs - Remove Last Link

Post by webmaz » Mon Feb 07, 2011 2:29 pm

Thanks for your reply. I tried out your suggested code and it did not appear to make any changes. The breadcrumb path still had a link for the current page. We're still working on getting this done. Do you have any other suggestions?

Thanks!

Post Reply