MVC5 using MvcSiteMapProvider to build twitter bootstrap menu

后端 未结 1 1767
暖寄归人
暖寄归人 2021-01-15 08:23

Default menu section in MVC5 template looking like that:

     
1条回答
  •  滥情空心
    2021-01-15 08:47

    Rowan's answer is pretty close to what you need to do, and should have led you down the correct path. The template MyMenu.cshtml can contain any logic you need to output the desired HTML. You simply need to modify the template to meet your requirement. Note that you can also modify the default templates if desired, but you will have to be careful to select "no" when asked to replace them during an upgrade of MvcSiteMapProvider, or your customizations will be overwritten.

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

    And then this line will produce the desired output:

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

    0 讨论(0)
提交回复
热议问题