Customise the SiteMapPath Control or use wild card URLs with a custom SiteMapProvider

A

Alexander Walker

Hello

I am using a custom site map provider to create a site map populated from a
database.

I am using the SiteMapPath control to display "bread crumbs" on the pages of my
site.

The database is divided into categories, each category contains items, there are
thousands of categories and tens of thousands of items. Correct me if I am
mistaken, but, I think that creating a site map that contains all of the
categories and all of the items in the database would not be feasible, so I have
limited the number of categories to the top three levels and excluded all items
from the site map, the remaining categories are pulled from the database as
needed.

The SiteMapPath Control produces output similar to the following line when a
certain URL is accessed

Category 1 / Sub Category 2 / Sub Category 3

The site map path above could be produced by using a URL such as the following

category.aspx?category=1&subcategory=2&childcategory=3

Each category page displays a list of items. The user can choose to select an
item to inspect it's details. The resultant URL would look like this

detail.aspx?category=1&subcategory=2&childcategory=3&item=1

At this point the SiteMapPath control does not display anything. I have tried
adding a dummy item entry to the site map that matches the following URL

detail.aspx?category=1&subcategory=2&childcategory=3

But this makes no difference. I was thinking of creating a customised
SiteMapPath Control that removed the "item" portion of the query string from the
URL so that it is treated like the dummy item that was set up in the site map,
but I can't figure out where to start, what method or property to override. Is
it possible to extend the behaviour of the SiteMapPath so that it will recognise
URLs that match only part a URL contained in the site map?

What can I do to cause the SiteMapPath control to display bread crumbs in a
situation where the actual URL does not exist in the sitemap, the URL I want to
match with is similar to URLs that are in the site map, are there any wild cards
that can be used when specifying the URL of sitemap entries?

Thanks

Alex
 
S

Steven Cheng[MSFT]

Hi Alex,

As for the SiteMapPath control, it will call the SiteMapProvider's method
to determine the current Node and path... e.g, the CurrentNode property
and the GetCurrentNodeAndHintAncestorNodes method... so how are you
currently doing in the custom sitemapprovider? From teh MSDN documenation,
it describe the "CurrentNode" property and the
GetCurrentNodeAndHintAncestorNodes method wihch can be overrided to provide
custom path resolving rules....

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Alexander Walker" <[email protected]>
| Subject: Customise the SiteMapPath Control or use wild card URLs with a
custom SiteMapProvider
| Date: Sat, 21 Jan 2006 03:03:00 -0000
| Lines: 52
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
| NNTP-Posting-Host: 81-6-217-221.gotadsl.co.uk 81.6.217.221
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontrols:32703
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
|
| Hello
|
| I am using a custom site map provider to create a site map populated from
a
| database.
|
| I am using the SiteMapPath control to display "bread crumbs" on the
pages of my
| site.
|
| The database is divided into categories, each category contains items,
there are
| thousands of categories and tens of thousands of items. Correct me if I
am
| mistaken, but, I think that creating a site map that contains all of the
| categories and all of the items in the database would not be feasible, so
I have
| limited the number of categories to the top three levels and excluded all
items
| from the site map, the remaining categories are pulled from the database
as
| needed.
|
| The SiteMapPath Control produces output similar to the following line
when a
| certain URL is accessed
|
| Category 1 / Sub Category 2 / Sub Category 3
|
| The site map path above could be produced by using a URL such as the
following
|
| category.aspx?category=1&subcategory=2&childcategory=3
|
| Each category page displays a list of items. The user can choose to
select an
| item to inspect it's details. The resultant URL would look like this
|
| detail.aspx?category=1&subcategory=2&childcategory=3&item=1
|
| At this point the SiteMapPath control does not display anything. I have
tried
| adding a dummy item entry to the site map that matches the following URL
|
| detail.aspx?category=1&subcategory=2&childcategory=3
|
| But this makes no difference. I was thinking of creating a customised
| SiteMapPath Control that removed the "item" portion of the query string
from the
| URL so that it is treated like the dummy item that was set up in the site
map,
| but I can't figure out where to start, what method or property to
override. Is
| it possible to extend the behaviour of the SiteMapPath so that it will
recognise
| URLs that match only part a URL contained in the site map?
|
| What can I do to cause the SiteMapPath control to display bread crumbs in
a
| situation where the actual URL does not exist in the sitemap, the URL I
want to
| match with is similar to URLs that are in the site map, are there any
wild cards
| that can be used when specifying the URL of sitemap entries?
|
| Thanks
|
| Alex
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top