I'm trying to build a dynamic site map on my site using SiteMapPath.
Should be like this:
Home > Products > %product_name% > Prices
where %product_name%
is set dynamically in the runtime, depending on the user's choice.
I've read many articles on the theme and choose this http://harriyott.com/2007/03/adding-dynamic-nodes-to-aspnet-site.aspx. It dynamically changes the web.sitemap
XML file. The problem is that it still builds the sitemap only once in the beginning and then uses it on each page.
How can I make it to rebuild on each loaded page?
Try this:
Right click on your project "add new item" then choose "Site Map", it will have an XML structure that looks like:
** adding description for each node is optional.
Now you need to place it where you want, so you add this code in the HTML side of the page:
Of course you have two pages - one for product and one for prices.
To assign Tile dynamically for some node in the SiteMap; add this code in the Prices Page:
1) In the page load:
2) Add this function in the same page (prices page):
As you can see you can manipulate the parent Node as you want, change the title, the url, etc. I think you want to change the url too; for example: "product.aspx?ID=blah"
Great! In case of someone wants the same in vb here is the code: