asp.net-mvc – 如何使用ASP.net MVC实现动态面包屑?

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – 如何使用ASP.net MVC实现动态面包屑?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何使用ASP.net MVC实现 dynamic breadcrumbs

如果你对什么是面包屑感到好奇:

@H_404_4@

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 > city of san francisco > bicycles

编辑

我意识到SiteMapProvider有什么可能。我也知道在网络上的提供者,将让你映射sitenode到控制器和操作。

但是,当你想要一个breadcrumb的文本匹配一些动态值,如下:

@H_404_4@

Home > Products > Cars > Toyota

Home > Products > Cars > Chevy

Home > Products > Execution Equipment > Electric Chair

Home > Products > Execution Equipment > Gallows

…其中产品类别和产品是来自数据库的记录。一些链接应该静态定义(主页肯定)。

我试图找出如何做到这一点,但我相信有人已经这样做与ASP.net MVC。

解决方法

在codeplex上有一个工具: http://mvcsitemap.codeplex.com/ [project moved to github]

编辑:

有一种方法来从数据库中驱动SiteMapProvider:http://www.asp.net/Learn/data-access/tutorial-62-cs.aspx

您可以修改mvcsitemap工具来使用它来获得所需的内容

原文链接:https://www.f2er.com/aspnet/254882.html

猜你在找的asp.Net相关文章