How to hide some map nodes from menu

  • Thread starter Thread starter Shimon Sim
  • Start date Start date
S

Shimon Sim

I have web.sitemap file that is used in sitemappath control. I also have a
menu that uses the same sitemap file. is it possible to "hide" some nodes
from menu but still have them available for SiteMapPath control.
I need it since some pages could be displayed only if the have some
parameters passed to them via url.
Thank you,
Shimon.
 
Simon,

Use the OnMenuItemDataBound event and you can check which node you're on by
looking at the menu item's text.

Protected Sub Menu1_MenuItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemDataBound

Try

If e.Item.Text = "Page2" Then
'---Don't show page2
e.Item.Text = ""
End If

Catch ex As Exception

ProcessException("There was an error during menu creation:", ex)

End Try

End Sub

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
OK.
This is kind of solution.
Is there a way to do this just by using sitemap file? This way it will be
easier to manage the whole thing.
Thanks.
 
Hi Shimon,

So far I think Justin's suggestion would be preferred since that approach
just focus on the Menu control's rendering. And actually the task you need
to do require the customization on multiple layers from sitemap provider to
site map controls. the default Site map provider(xml file) only support
show/hide nodes depend on role setting. If you want to do it at
configuration file level and make the visibility different between
different controls, we need to customize both the sitemapprovider and the
certain site map controls.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

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.
 

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

Back
Top