How to lose a menu in one easy step...
Posted on
1/4/2007 9:24:12 AM
in
ASP.NET Development
For the last few days, I've been playing around with a menu control with Security Trimming enabled. It seems like a really good idea, the documentation from Microsoft is mildly informative, there's a fairly extensive exploration of the new navigation controls going on over at 4GuysFromRolla, and there's a few other people that have put together some demos of creating menus and treeviews from .sitemap files.
While all of these shine in one way or another, none of them let you know one very crucial point that if you're not aware of will cause entire menu nodes to disappear before your very eyes.
Here's the scenario which lead me to this grizzly and time wasting discovery.
I wanted to add a vertical menu for navigation to the left side of a site that I'm developing. Pretty simple requirement.
The way the .sitemap file is structured, there is one, and only one, root <siteMapNode> tag, and all the other <siteMapNode> tags are nested below this root.
Given that structure, my menu would have the "Home" menu node as the only menu node being displayed. Pretty simple solve here, too...switch the SiteMapDataSource's "ShowStartingNode" property to 'False' and now all of your child nodes become the "root" nodes of the menu.
In my solution, these child nodes that have just been promoted to parent/root nodes need to have child nodes of their own to allow access to the various pages. Simple enough...I just added more child <siteMapNode>s to the parent/root nodes.
Here's where it all goes downhill...in my application, I don't want the parent/root nodes to have any navigation unto themselves...merely display the triangle at the right to indicate there's more below. So, I go to my sitemap file and remove the url property from the parent/root node, and *poof* the whole menu for that parent/root disappears.
I've spent a few more hours trying to find a resolution to this, but there doesn't seem to be one out there. The control itself doesn't have any easily identified property that will "cancel" the navigation capabilities of the parent/root node, either.
Is it me, or is this rather poorly thought out? If you go to the 'History' menu item in Firefox, you're not directed to a magical "History" page...it spawns the child options available from that parent. Why can't the web control behave in the same manner?
I'd love your thoughts, or suggestions if I'm missing something obvious that will give my menu the desired behavior.
|
Posted on
5/25/2009 6:03:20 AM
I have a question about SiteMapPath. Though it is not related the topic, I could not find other proper place to raise it, so I ask it here.
My question is:
When you use SiteMapPath as a breadcrumb trail, info contained in the trail are loaded from web.sitemap file. Suppose the web.sitemap is in English, then how can I load a different web.sitemap file for another language?
|