Mihir
Mihir

Reputation: 8734

menu item not visible, when url attribute of sitemapnode is empty

Similar question was asked here But it doesn't provide any solution. The accepted answer for this question only works for one menu item. If we use "#" as a url for multiple items then it will give error like same url # was used multiple times. Thats why I again posted this to hear solution from experts. My question is,

I have sitemap like below.

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode title="Invisible" description="Main Page" url="Menu.aspx" >
    <siteMapNode title="Home" url="Default.aspx" />
    <siteMapNode  title="Time Sheets" url="#">
      <siteMapNode title="Time Sheet Entry" description="Menu one" url="Menu1.aspx" />
      <siteMapNode title="Time Sheet Approval" description="Menu Two" url="Menu2.aspx" />
    </siteMapNode>
    <siteMapNode title="Leaves">
      <siteMapNode title="Leave Request" url="leaverequest.aspx" />
      <siteMapNode title="Leave Approval" url="leaveapproval.aspx"/>
    </siteMapNode>
    <siteMapNode roles="Administrator" description="Only for administrators" title="Reports" url="SubMenu1.aspx" />
    <siteMapNode  title="Administration" url="~/UserRegistration.aspx"  >
      <siteMapNode  title="Register New User" url="~/Account/AdminRegister.aspx"></siteMapNode>
    </siteMapNode>
    <siteMapNode title="Help" url="~/Account/UserSettings.aspx" description=""></siteMapNode>
  </siteMapNode>
</siteMap>

For leaves node there is no any url. Under the leaves there are two submenus. These only contains urls to a specific page. But when i render this in my master page, the Leaves node not at all appearing. I tried with empty url attribute like <siteMapNode title="Leaves" url="#">. This also doesn't provide me the solution. What would be the mistake in my sitemap page?

Upvotes: 1

Views: 1926

Answers (2)

mikev2
mikev2

Reputation: 110

I realise this is an old question, but if you define the roles attribute as non-empty, eg.

<siteMapNode url="" title="Leaves" roles="*">

Then the node is rendered. Unfortunately, I do not know why. Hope this helps someone!

Upvotes: 0

GeniusOfTheNet
GeniusOfTheNet

Reputation: 26

The easiest solution that I did for this exact scenario was to put "#" on the first URL, then "##" on the second, "###" on the third and so on. This makes the links non-clickable and also satisfies the unique url rule. Hack? maybe, but works for what I'm using it for.

Upvotes: 1

Related Questions