MVC5 using MvcSiteMapProvider to build twitter bootstrap menu

后端 未结 2 1856
傲寒
傲寒 2021-01-15 08:25

Default menu section in MVC5 template looking like that:

     
2条回答
  •  猫巷女王i
    2021-01-15 09:02

    If I recall correctly you can specify the DisplayTemplate in the Menu() method.

    Navigate to ~/Views/Shared/DisplayTemplates and create a new view called MyMenu.cshtml.

    Set the model type to MvcSiteMapProvider.Web.Html.Models.MenuHelperModel and then specify the menu structure (with HTML).

    MyMenu.cshtml

    @model MvcSiteMapProvider.Web.Html.Models.MenuHelperModel
    @using MvcSiteMapProvider.Web.Html.Models
    
    
    

    Now change your Menu() method.

    @Html.MvcSiteMap().Menu("MyMenu")
    

提交回复
热议问题