创建asp.net MVC面包屑路径 [英] Create breadcrumbs Path in asp.net MVC

查看:378
本文介绍了创建asp.net MVC面包屑路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创造一个面包屑,包括用户浏览过的网页,
像例如:

I'm trying to create a breadcrumbs that includes pages viewed by user, like the example:

首页 - >产品 - >智能手机 - > ......

Home -> Products -> Smartphones -> .....

有谁知道该怎么做,在asp.net MVC 3剃刀视图引擎?
或在哪里可以找到一个很好的教程?

Does anyone know how to do that in asp.net mvc 3 with razor view engine ? Or where i can find a good tutorial ?

推荐答案

有被称为开源项目 MvcSiteMapProvider 我一直贡献,使这个相当容易。该项目可在的NuGet。

There is an open source project called MvcSiteMapProvider that I have been contributing to that makes this fairly easy. The project is available on NuGet.

基本上,您配置与您所有的页面的站点地图。站点地图可以在XML中,code来配置,或者从另一数据源。然后,站点地图缓存和用户之间共享。当用户导航到在网站地图配置(无论是作为一个URL或路由值的字典)的URL,它将使用的相对位置在地图上确定如何构建面包屑回你的主页。

Basically, you configure an sitemap with all of your pages. The sitemap can be configured in XML, code, or from another data source. The sitemap is then cached and shared between users. When a user navigates to a URL that is configured in the sitemap (either as a URL or as a dictionary of route values), it will use the relative position in the map to determine how to build breadcrumbs back to your home page.

有是安装和使用此功能,它的演练:的 MvcSiteMapProvider 4.0 - 试车

There is a walk-through of installing and using its features here: MvcSiteMapProvider 4.0 - A Test Drive

这篇关于创建asp.net MVC面包屑路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆