Discussion:
ASP.NET Menu & SiteMapPath
(too old to reply)
horace
2007-12-15 03:21:00 UTC
Permalink
Hi,

In my website, it has a menu and a breadcrumb trail. I am using ASP.NET
"Menu" & "SiteMapPath" controls to do these. My "Web.sitemap" is as follows:

<siteMap>
<siteMapNode title="Dummy" url="Default.aspx">
<siteMapNode title="Menu 1" url="Page1.aspx">
<siteMapNode title="Menu 1a" url="Page1a.aspx" />
<siteMapNode title="Menu 1b" url="Page1b.aspx" />
</siteMapNode>
<siteMapNode title="Menu 2" url="Page2.aspx">
<siteMapNode title="Menu 2a" url="Page2a.aspx" />
<siteMapNode title="Menu 2b" url="Page2b.aspx" />
</siteMapNode>
<siteMapNode title="Menu 3" url="Page3.aspx">
<siteMapNode title="Menu 3a" url="Page3a.aspx" />
<siteMapNode title="Menu 3b" url="Page3b.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>

And my SiteMapDataSource is set as follows:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="false" />

The reason i set ShowStartingNode="false" is that i don't want to show the
"Dummy" memu item.

Everything worked fine with the menu. However, problem occurred when i
worked with a Sitemappath:
Dummy > Menu 1 > Menu 1a

How can i make the "Dummy" siteMapNode invisible by changing those
properties of the "SiteMapPath" control? Pls kindly advise.
_____

In fact, my ultimate goal is just want to make my menu and sitemappath look
like this:

[Menu]
Menu 1
- Menu 1a
- Menu 1b
Menu 2
- Menu 2a
- Menu 2b
Menu 3
- Menu 3a
- Menu 3b


[SiteMapPath]
Menu 1 > Menu 1a
Menu 2 > Menu 2a
...
...

So any suggestion is welcome such as doing some tricks on the "Web.sitemap"
file and any other else. Thank you in advance.

B.Rgds,
horace
horace
2007-12-15 03:26:00 UTC
Permalink
Hi,

One more thing for yr information:
I failed to hide the "Dummy" item in the SiteMapPath as it refers to my
"XmlSiteMapProvider" instead of my "SiteMapDataSource". Thanks.

B.Rgds,
horace
Post by horace
Hi,
In my website, it has a menu and a breadcrumb trail. I am using ASP.NET
<siteMap>
<siteMapNode title="Dummy" url="Default.aspx">
<siteMapNode title="Menu 1" url="Page1.aspx">
<siteMapNode title="Menu 1a" url="Page1a.aspx" />
<siteMapNode title="Menu 1b" url="Page1b.aspx" />
</siteMapNode>
<siteMapNode title="Menu 2" url="Page2.aspx">
<siteMapNode title="Menu 2a" url="Page2a.aspx" />
<siteMapNode title="Menu 2b" url="Page2b.aspx" />
</siteMapNode>
<siteMapNode title="Menu 3" url="Page3.aspx">
<siteMapNode title="Menu 3a" url="Page3a.aspx" />
<siteMapNode title="Menu 3b" url="Page3b.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="false" />
The reason i set ShowStartingNode="false" is that i don't want to show the
"Dummy" memu item.
Everything worked fine with the menu. However, problem occurred when i
Dummy > Menu 1 > Menu 1a
How can i make the "Dummy" siteMapNode invisible by changing those
properties of the "SiteMapPath" control? Pls kindly advise.
_____
In fact, my ultimate goal is just want to make my menu and sitemappath look
[Menu]
Menu 1
- Menu 1a
- Menu 1b
Menu 2
- Menu 2a
- Menu 2b
Menu 3
- Menu 3a
- Menu 3b
[SiteMapPath]
Menu 1 > Menu 1a
Menu 2 > Menu 2a
...
...
So any suggestion is welcome such as doing some tricks on the "Web.sitemap"
file and any other else. Thank you in advance.
B.Rgds,
horace
v***@prcvap.microsoft.com
2007-12-17 05:15:07 UTC
Permalink
horace
2007-12-17 06:35:00 UTC
Permalink
Hi Wen Yuan,

I copied and pasted the codes in the Global.asax and got the following error:

"NullReferenceException was unhandled by user code"
"Object reference not set to an instance of object"

at the following line of codes:
SiteMapNode node = SiteMap.CurrentNode.Clone();

Pls kindly advise. Thanks.

B.Rgds,
horace
Hello Horace,
Hiding the root node is not native supported in SiteMapPath controller. A workaround is to remove the root node in SiteMapResolve event. It's a common issue, fordetailed information, you may refer to
http://www.wintellect.com/cs/blogs/jprosise/archive/2006/06/22/hiding-the-root-node-from-sitemappath.aspx
[Hiding the Root Node from SiteMapPath ]
Hope this helps,
Best regards,
Wen Yuan
Wen Yuan
Microsoft Online Support
Microsoft Global Technical Support Center
Get Secure! - www.microsoft.com/security
=====================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights
horace
2007-12-17 07:33:00 UTC
Permalink
Hi Wen Yuan,

I've just solved my problem. So pls kindy ignore my following posting. Sorry
for any inconvenience caused and thank you very much!

B.Rgds,
horace
Post by horace
Hi Wen Yuan,
"NullReferenceException was unhandled by user code"
"Object reference not set to an instance of object"
SiteMapNode node = SiteMap.CurrentNode.Clone();
Pls kindly advise. Thanks.
B.Rgds,
horace
Hello Horace,
Hiding the root node is not native supported in SiteMapPath controller. A workaround is to remove the root node in SiteMapResolve event. It's a common issue, fordetailed information, you may refer to
http://www.wintellect.com/cs/blogs/jprosise/archive/2006/06/22/hiding-the-root-node-from-sitemappath.aspx
[Hiding the Root Node from SiteMapPath ]
Hope this helps,
Best regards,
Wen Yuan
Wen Yuan
Microsoft Online Support
Microsoft Global Technical Support Center
Get Secure! - www.microsoft.com/security
=====================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights
v***@prcvap.microsoft.com
2007-12-19 03:21:36 UTC
Permalink
Loading...