如何动态地面包屑与ASP.net MVC实现? [英] How can dynamic breadcrumbs be achieved with ASP.net MVC?
问题描述
如何动态面包与ASP.net MVC实现?
How can dynamic breadcrumbs be achieved with ASP.net MVC?
如果您想了解面包是什么:
If you are curious about what breadcrumbs are:
什么是面包屑?好吧,如果你曾经浏览过网上商店或在一个论坛上的帖子看,你可能已经遇到了面包屑。他们提供了一个简单的方法来看看你是一个网站,在这里。像Craigslist的网站使用面包屑来描述用户的位置。上面每一页上的清单的东西,看起来像这样:
What are breadcrumbs? Well, if you have ever browsed an online store or read posts in a forum, you have likely encountered breadcrumbs. They provide an easy way to see where you are on a site. Sites like Craigslist use breadcrumbs to describe the user's location. Above the listings on each page is something that looks like this:
S.F。 bayarea Craigslist网站>旧金山市>自行车
s.f. bayarea craigslist > city of san francisco > bicycles
我体会到什么是可能的SiteMapProvider。我也知道提供者那里在网上,可以让你sitenodes映射到控制器和行动。
EDIT
I realize what is possible with the SiteMapProvider. I am also aware of the providers out there on the net that will let you map sitenodes to controllers and actions.
但是,当你想要什么面包屑的文本相匹配的一些动态值,如:
But, what about when you want a breadcrumb's text to match some dynamic value, like this:
首页>产品>汽车>丰田汽车
Home > Products > Cars > Toyota
首页>产品>汽车>雪佛兰
Home > Products > Cars > Chevy
首页>产品>执行设备>电动椅
Home > Products > Execution Equipment > Electric Chair
首页>产品>执行设备>绞架
Home > Products > Execution Equipment > Gallows
...其中的产品类别,产品是从一个数据库中的记录。有些链接应该静态定义(家庭肯定的)。
... where the product categories and the products are records from a database. Some links should be defined statically (Home for sure).
我试图找出如何做到这一点,但我敢肯定有人已经与ASP.net MVC做到了这一点。
I am trying to figure out how to do this, but I'm sure someone has already done this with ASP.net MVC.
推荐答案
还有就是做这个codePLEX的工具: HTTP://mvcsitemap.$c$cplex.com/ [项目转移到GitHub上]
There is a tool to do this on codeplex: http://mvcsitemap.codeplex.com/ [project moved to github]
编辑:
有一种方法可以从数据库驱动SiteMapProvider:<一href=\"http://www.asp.net/Learn/data-access/tutorial-62-cs.aspx\">http://www.asp.net/Learn/data-access/tutorial-62-cs.aspx
There is a way to drive a SiteMapProvider from a database: http://www.asp.net/Learn/data-access/tutorial-62-cs.aspx
您可能能够修改mvcsitemap工具,用它来得到你想要的东西。
You might be able to modify the mvcsitemap tool to use that to get what you want.
这篇关于如何动态地面包屑与ASP.net MVC实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!