This is a migrated thread and some comments may be shown as answers.

Use partial view for menu item?

3 Answers 26 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jfkrueger
Top achievements
Rank 1
jfkrueger asked on 25 May 2012, 06:42 PM
I am using the menu with a SiteMap. I have a menu item that takes the user to the shopping cart but I would like it to include the number of items in the cart, IE  [Cart (2)]. Is there any way to achieve this?

3 Answers, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 30 May 2012, 02:00 PM
Hi Joe,

Basically you can use the overload of the BindTo method which accepts a SiteMap name and configuration method to add your cart details to the end of the text of the item.
e.g.
.BindTo("yourSiteMapName",(Telerik.Web.Mvc.UI.MenuItem item, Telerik.Web.Mvc.SiteMapNode siteMapNode) =>
        {
            if (item.Text.EndsWith("Cart"))
            {
                item.Text += "(Insert your Cart Number Here)";
            }
             
        })

I hope this helps.

All the best,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
jfkrueger
Top achievements
Rank 1
answered on 04 Jun 2012, 02:00 PM
Very cool, I will give it a shot and post back my results.

Thank you!
0
jfkrueger
Top achievements
Rank 1
answered on 05 Jun 2012, 01:07 PM
Exactly what I needed, thank you!
Tags
Menu
Asked by
jfkrueger
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
jfkrueger
Top achievements
Rank 1
Share this question
or