SiteMapPath Question

S

sean.marchetti

Hello,

I am having a little difficulty coming up with a solution for the
following requirement and I was hoping somebody might be able to offer
some help. I need to create a SiteMapPath for a category system that
supports any number of nested categories. Here's what I mean:

Category A
Category B
Category C
Category D
Category E

This information is stored in a single Categories table in my database
and looks like this:

Id ParentId Name
------------------------------------------------------
1 NULL Category A
2 1 Category B
3 2 Category C
4 NULL Category D
5 4 Category E

If the user was on the details page for Category C, the SiteMapPath
should display Home > Category A > Category B > Category C and the user
should be able the backtrack through the nested structure.

I know that I can create a custom SiteMapProvider that can use a
database as its data source, but I am not sure if this is the right
way. Any feedback would be highly appreciated. Thanks!
 
A

Alan Silver

Hello,

I am having a little difficulty coming up with a solution for the
following requirement and I was hoping somebody might be able to offer
some help. I need to create a SiteMapPath for a category system that
supports any number of nested categories. Here's what I mean:

Category A
Category B
Category C
Category D
Category E

This information is stored in a single Categories table in my database
and looks like this:

Id ParentId Name
------------------------------------------------------
1 NULL Category A
2 1 Category B
3 2 Category C
4 NULL Category D
5 4 Category E

If the user was on the details page for Category C, the SiteMapPath
should display Home > Category A > Category B > Category C and the user
should be able the backtrack through the nested structure.

I know that I can create a custom SiteMapProvider that can use a
database as its data source, but I am not sure if this is the right
way. Any feedback would be highly appreciated. Thanks!

I did something very similar to this. What I did was that every time the
database was changed, I wrote out a categories.sitemap file (the format
is very simple) and then used a standard sitemappath control in the
..aspx file. Worked a treat and avoided database hits every time.

HTH
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top