mvc 3站点地图提供程序-指向同一节点的多个路径
我最近开始使用 marteenba 的 站点地图提供程序,因为我无法解决其他站点地图的路线问题我有。这比我之前的好多了。我的问题是:如何从转到单个主页的页面创建不同的面包屑路径?考虑下面的想法:
站点地图结构
<mvcSiteMapNode title="Home" controller="Home" action="Index" changeFrequency="Always" updatePriority="Normal">
<mvcSiteMapNode title="Clients Search" controller="ClientBussiness" action="ClientSearch" description="Clients Search">
<mvcSiteMapNode title="Contract Analysis" controller="Contract" action="Index"/>
</mvcSiteMapNode>
<mvcSiteMapNode title="Advanced Search" controller="ClientBussiness" action="AdvancedSearch" description="Clients Advanced Search">
<mvcSiteMapNode title="Contract Analysis" controller="Contract" action="Index"/>
</mvcSiteMapNode>
<mvcSiteMapNode title="Another Search" controller="ClientBussiness" action="AnotherSearch" description="Clients Another Search">
<mvcSiteMapNode title="Contract Analysis" controller="Contract" action="Index"/>
</mvcSiteMapNode>
</mvcSiteMapNode>
在上面的示例中,我的面包屑路径始终显示节点“客户端搜索”而不是任何其他节点。我不知道是否应该为每种搜索创建不同的路线(我在上一个站点地图上这样做了,但不幸的是 iis6 不喜欢它)。
我很感激你的帮助。
编辑
在论坛上搜索我发现了类似的问题。因此,请考虑以下结构:
Home >> Search >> Contracts
Home >> Another Search >> Contracts
Home >> Advanced Search >> Contracts
Home >> Web Service Search >> Extra fields >> Contracts
i've recently started to use marteenba's sitemap provider, because i couldn't solve a route problem with the other sitemap i had. It's way better than my previous one. My question is: how can i create different breadcrumb trails from pages that go to a single main page? Consider the idea below:
Sitemap Structure
<mvcSiteMapNode title="Home" controller="Home" action="Index" changeFrequency="Always" updatePriority="Normal">
<mvcSiteMapNode title="Clients Search" controller="ClientBussiness" action="ClientSearch" description="Clients Search">
<mvcSiteMapNode title="Contract Analysis" controller="Contract" action="Index"/>
</mvcSiteMapNode>
<mvcSiteMapNode title="Advanced Search" controller="ClientBussiness" action="AdvancedSearch" description="Clients Advanced Search">
<mvcSiteMapNode title="Contract Analysis" controller="Contract" action="Index"/>
</mvcSiteMapNode>
<mvcSiteMapNode title="Another Search" controller="ClientBussiness" action="AnotherSearch" description="Clients Another Search">
<mvcSiteMapNode title="Contract Analysis" controller="Contract" action="Index"/>
</mvcSiteMapNode>
</mvcSiteMapNode>
On the example above, my breadcrumb trail always shows the node Clients Search instead of any other. I don't know if should create different routes for each kind of search (i did this on my last sitemap, but unfortunately iis6 didn't like it).
I appreciate your help.
EDIT
searching on forums i found a similar question. So, consider the structure below:
Home >> Search >> Contracts
Home >> Another Search >> Contracts
Home >> Advanced Search >> Contracts
Home >> Web Service Search >> Extra fields >> Contracts
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来我需要做的就是在我的控制器上添加一些动态节点属性。您可以在此处阅读操作方法。使用上面的示例,其完成方式如下:
在上面的示例中,每种搜索都将在面包屑路径上正确定义。
请记住,您必须为要使用的每种“搜索”定义不同的路线。因此,如果您希望有 3 个节点指向相同的 url,则每个节点必须有自己的路由及其键(在
MvcSiteMapNodeAttribute
上定义)。Well it seems that all i needed to do was to add some dynamic nodes attributes on my controllers. You can read how to do it here. Using the example above, here's how it's done:
On the example above, each kind of search will be properly defined on the breadcrumb trail.
Keep in mind that you have to define different routes for each kind of "search" you want to use. So, if you want to have 3 nodes pointing to the same url, each node must have it's own route and it's key, defined on
MvcSiteMapNodeAttribute
.