【发布时间】:2017-08-02 13:49:49
【问题描述】:
我尝试将 MvcSiteMapProvider 用于面包屑。
我有以下站点地图文件:
<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="Home" controller="Home" action="Index" key="Index">
<mvcSiteMapNode title="About" controller="Home" action="About"/>
<mvcSiteMapNode title="Company List" controller="Company" action="Index" key="Company">
<mvcSiteMapNode title="Create company" controller="Company" action="Create" />
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMap>
并显示它:
@Html.MvcSiteMap().SiteMapPath()
它适用于“创建公司”、“公司列表”等页面
然后我想将它添加到带有参数的操作中:
[MvcSiteMapNode(Title = "Company Details", ParentKey = "Company", Key = "CompanyDetails")]
public ActionResult Details(int? id)
{
...
CompanyDetailVM model = mapper.Map<CompanyDetailVM>(company);
return View(model);
}
但它不起作用,根本没有显示面包屑。哪里出错了?
【问题讨论】:
标签: asp.net-mvc breadcrumbs mvcsitemapprovider