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

谁说胖子不能爱 提交于 2020-01-04 04:36:46

问题


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


回答1:


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.




回答2:


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:


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"/>


来源:https://stackoverflow.com/questions/2902265/asp-net-menu-only-show-certain-nodes-in-web-sitemap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!