Page 1 of 1

Breadcrumbs - Remove Last Link

Posted: Tue Jan 18, 2011 3:21 pm
by webmaz
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!

Re: Breadcrumbs - Remove Last Link

Posted: Mon Feb 07, 2011 10:53 am
by s_ismail
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));
    }

Re: Breadcrumbs - Remove Last Link

Posted: Mon Feb 07, 2011 2:29 pm
by webmaz
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!