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

Adding Additional MenuItems to Menu When Binding to a SiteMap

1 Answer 33 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.
dwhite
Top achievements
Rank 1
dwhite asked on 13 Dec 2011, 08:08 PM
I would like to add a "Home" MenuItem to the generated menu from the SiteMap. Home is actually my root element, but I would just like to add an item for this into the currently generated menu. In other words, how would I prepend/append items manually? I could cheat and just have it outside of the generated UL, but I'd rather in be in the generated HTML.

Thanks,
-Damien

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 15 Dec 2011, 06:20 PM
Hi Damien,

You could append the Home MenuItem by adding it after calling BindTo. For example:

@(Html.Telerik().Menu()
    .BindTo("SiteMapName")
    .Name("Menu")
    .Items(items =>
    {
        items.Add().Text("Home").Action("ActionName","ControllerName");
    })
)


Kind regards,
Daniel
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
Tags
Menu
Asked by
dwhite
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or