{"id":4871,"date":"2014-03-30T16:11:53","date_gmt":"2014-03-30T16:11:53","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/dynamically-built-sitemappath-in-asp-net-collection-of-common-programming-errors\/"},"modified":"2014-03-30T16:11:53","modified_gmt":"2014-03-30T16:11:53","slug":"dynamically-built-sitemappath-in-asp-net-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/dynamically-built-sitemappath-in-asp-net-collection-of-common-programming-errors\/","title":{"rendered":"dynamically built SiteMapPath in asp.net-Collection of common programming errors"},"content":{"rendered":"<p>Try this:<\/p>\n<p>Right click on your project &#8220;add new item&#8221; then choose &#8220;Site Map&#8221;, it will have an XML structure that looks like:<\/p>\n<pre><code>\n\n     \n\n       \n\n         \n\n             \n\n                 \n\n             \n\n         \n\n       \n\n     \n<\/code><\/pre>\n<p>** adding description for each node is optional.<\/p>\n<p>Now you need to place it where you want, so you add this code in the HTML side of the page:<\/p>\n<pre><code>\n\n\n\n   \n\n      <img loading=\"lazy\" decoding=\"async\" runat=\"server\" alt=\"\" src=\"an%20image%20to%20separate%20between%20nodes\" height=\"5\" width=\"5\" \/>\n\n   \n\n\n<\/code><\/pre>\n<p>Of course you have two pages &#8211; one for product and one for prices.<\/p>\n<p>To assign Tile dynamically for some node in the SiteMap; add this code in the Prices Page:<\/p>\n<p>1) In the page load:<\/p>\n<pre><code>SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(SiteMap_SiteMapResolve);\n<\/code><\/pre>\n<p>2) Add this function in the same page (prices page):<\/p>\n<pre><code> SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e)\n{\n    SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);\n    SiteMapNode tempNode = currentNode;\n\n    tempNode.ParentNode.Title = \"Change the Product name\";\n    tempNode.ParentNode.Url = \"Change the Product url\";\n\n    return currentNode;\n}\n<\/code><\/pre>\n<p>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: &#8220;product.aspx?ID=blah&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Try this: Right click on your project &#8220;add new item&#8221; then choose &#8220;Site Map&#8221;, 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4871","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4871"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4871\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}