ASP.net menu only show certain nodes in Web.sitema

2019-07-04 16:40发布

I have a few items apart of my Web.sitemap file that rely on querystring or session variables. I do not want these items to appear in my menu.

Is there a way to hide it from the menu, but still be in the sitemap (for sitepath control).

Thanks

3条回答
姐就是有狂的资本
2楼-- · 2019-07-04 17:00

Solved it...

I just made the title of the siteMapNode I want to be hidden to "[hidden]". In the .cs file the sitemap control sits I did this...

protected void rmMenu_ItemDataBound(object sender, RadMenuEventArgs e)
{
    if (e.Item.Text == "[hidden]")
    e.Item.Remove();
}
查看更多
劫难
3楼-- · 2019-07-04 17:07

I believe you use the attribute show="false", like so:

<siteMapNode show="false" url="~/admin/submissionsaddedit.aspx" title="Add/Edit Submission"  description="" roles="Administrator, Shortlister, Moderator"/>
查看更多
霸刀☆藐视天下
4楼-- · 2019-07-04 17:26

I used this article when I wanted to stop an node from appearing I found this article great:

http://runtingsproper.blogspot.com/2009/11/i-bet-you-didn-know-that-adding-custom.html

ASP.NET does have functionality to control which nodes you want displayed but I believe this is tied to Membership/Roles.

查看更多
登录 后发表回答