与MVC SiteMapProvider嵌套的面包屑

时间:2019-06-03 10:57:05

标签: asp.net-mvc asp.net-mvc-4 model-view-controller mvcsitemapprovider sitemapprovider

菜单结构

enter image description here

当我单击“品牌”菜单链接时,面包屑显示为(“仪表板”>“品牌”),我可以接受
但是,当我单击“客户”>“品牌”链接

  

面包屑显示为( Dashboard> Brand ),但我期望输出为( Dashboard> Client> Brand
  
  我如何使用MvcSiteMapProvider进行此操作:https://github.com/maartenba/MvcSiteMapProvider

MVC.Sitemap

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0" xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd">   
<mvcSiteMapNode title="Dashboard" controller="Dashboard" action="Index">
    <mvcSiteMapNode title="Brand" controller="Master" action="Brand"></mvcSiteMapNode>
    <mvcSiteMapNode title="Client" controller="Client" action="Index">          
        <mvcSiteMapNode title="Brand" controller="Master" action="Brand"></mvcSiteMapNode>
    </mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMap>

MasterController.cs

public class MasterController : Controller
{
        // GET: Master
        public ActionResult Index()
        {
            return View();
        }

        // GET: Master
        [Route("Brand")]
        public ActionResult Brand()
        {
            return View();
        }
}

ClientController.cs

public class ClientController : Controller
    {
        // GET: Client
        [Route("Client")]
        public ActionResult Index()
        {
            return View();
        }
    }

0 个答案:

没有答案