MVC3 and breadcrumb navigation
I try to create something like breadcrumb navigation using MVC3.
When 开发者_如何学编程user go to page he has for example: Home (id = 1), About (id = 2), and Hello (id = 3) links. These links I get from a database. When I click on Home I go to the database and get a new set of links: Home -- Link1 (id = 3), Link2 (id = 4), etc.
If I not have nothing from database then I show some page content.
Home -- Link1 -- Some Others
Page Content
How can I achieve this?
We have had success using the MVC SiteMap project for breadcrumb navigation. If you cannot make use of this project directly for whatever reason, you could at least take a look at the source code to see how they implemented breadcrumbs.
The method that emits the breadcrumb navigation is: Html.MvcSiteMap().SiteMapPath()
精彩评论