Bread crumbs with url rewriting

In database I have a list of hierarchical list of categories so i construct a Custom Sitemap provider (by extending StaticSiteMapProvider ) with this list of categories.

Now, the page that display articles /ShowArticle.aspx?id=" + Eval("ID") is rewrited into:
/id/article-title.aspx.
So it's not physical exists.

I want the following: When the selected page is displayed I want to display the complete category path in the "Bread crumbs" (every article has a "category" property that contains it's 1 lvl category - without parents)

For example categories structure:

Home  
   Products 
      CdRom
      DvdRom
        Toshiba
   Support
     Hardware 
     Software 

When an article id=xx,category=Toshiba, title="Best Toshiba DVD" is opened, the path in "Bread crumbs" should be:
Home|Products|DvdRom|Toshiba|Best Toshiba DVD

How to do it? Should I add something to my custom Sitemap provider?


I don't get any answers :(
Maybe I should do like this:
Instead constructing the site map for categories, i should construct it both for categories and all available articles in the database.
It's not efficient (even with caching), but it's the only way i think.

What else can I do?

Update: What is left is just to create dynamically list of links that will act as bread crumbs, when an article is opened it's containing category will be read and full hierarchical categories path will be calculated (from root to this current node).


I had to look up what the SiteMap provider was, and in doing so accidently came across the answer you may be looking for on the MSDN website: Breadcrumb using SiteMapPath Class

It might not be quite what you are after but it could be a point in the right direction :)

链接地址: http://www.djcxy.com/p/39080.html

上一篇: 在Django中实现面包屑

下一篇: 面包屑与URL重写