我需要隐藏我的一些菜单项,但我不知道如何。
我从 web.siteMap xml 文件中获取数据,因为它是站点地图,所以我已将所有页面都包含在我的网站中。问题是,其中一些页面需要一个查询字符串才能正常运行;而且我不想告诉用户他在错误的页面上,因为他从菜单中单击了一个他不应该拥有的项目。所以我决定应该隐藏这些页面。
编辑:我想删除:
<siteMapNode url="~/Categories/review_tab.aspx" title="TABLET REVIEWS" description="TABLET REVIEWS"/>
<siteMapNode url="~/Categories/review_lap.aspx" title="LAPTOP REVIEWS" description="LAPTOP REVIEWS"/>
<siteMapNode url="~/Categories/review_tab.aspx" title="TABLET REVIEWS" description="TABLET REVIEWS"/>
<siteMapNode url="~/Categories/review_cam.aspx" title="CAMERA REVIEWS" description="CAMERA REVIEWS"/>
站点地图的结构如下:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/" title="Menu" description="Menu">
<siteMapNode url="~/Default.aspx" title="HOME" description="HOME"></siteMapNode>
<siteMapNode url="~/ContactUs.aspx" title="CONTACT US" description="CONTACT US" />
<siteMapNode url="~/About.aspx" title="ABOUT US" description="ABOUT US" />
<siteMapNode url="~/Members/Default.aspx" title="MEMBERS" description="MEMBERS">
<siteMapNode url="~/Members/ChangePassword.aspx" title="CHANGE PASSWORD" description="CHANGE PASSWORD" />
</siteMapNode>
<siteMapNode url="~/login.aspx" title="REVIEWS" description="REVIEWS">
<siteMapNode url="~/Categories/Laptops.aspx" title="LAPTOP" description="LAPTOP"/>
<siteMapNode url="~/Categories/review_lap.aspx" title="LAPTOP REVIEWS" description="LAPTOP REVIEWS"/>
<siteMapNode url="~/Categories/Smartphones.aspx" title="SMARTPHONE" description="SMARTPHONE"/>
<siteMapNode url="~/Categories/review_smart.aspx" title="SMARTPHONE REVIEWS" description="SMARTPHONE REVIEWS"/>
<siteMapNode url="~/Categories/Tablets.aspx" title="TABLETS" description="TABLETS"/>
<siteMapNode url="~/Categories/review_tab.aspx" title="TABLET REVIEWS" description="TABLET REVIEWS"/>
<siteMapNode url="~/Categories/Cameras.aspx" title="CAMERAS" description="CAMERAS"/>
<siteMapNode url="~/Categories/review_cam.aspx" title="CAMERA REVIEWS" description="CAMERA REVIEWS"/>
</siteMapNode>
<siteMapNode url="~/Account/Default.aspx" title="ACCOUNT" description="ACCOUNT">
<siteMapNode url="~/Account/Register.aspx" title="REGISTER" description="REGISTER"/>
<siteMapNode url="~/Account/ForgotPassword.aspx" title="FORGOT PASS" description="FORGOT PASS" />
</siteMapNode>
<siteMapNode url="~/Administrator/Default.aspx" title="ADMIN" description="ADMIN ">
<siteMapNode url="~/Administrator/Laptops.aspx" title="LAPTOP" description="LAPTOP"/>
<siteMapNode url="~/Administrator/Smartphones.aspx" title="SMARTPHONE" description="SMARTPHONE"/>
<siteMapNode url="~/Administrator/Tablets.aspx" title="TABLETS" description="TABLETS"/>
<siteMapNode url="~/Administrator/Cameras.aspx" title="CAMERAS" description="CAMERAS"/>
</siteMapNode>
</siteMapNode>
</siteMap>
菜单:
.
.
.
<div id="menu_div" align="left" dir="ltr">
<asp:Menu ID="Menu1" runat="server" BackColor="#C0BFBD"
DataSourceID="SiteMapDataSource1" DynamicHorizontalOffset="2"
Font-Names="Calibri" Font-Size="Medium" ForeColor="#2C2F36"
StaticSubMenuIndent="10px" RenderingMode="Table"
StaticEnableDefaultPopOutImage="False" style="margin-right: 0px"
Font-Bold="True" DisappearAfter="200">
<DynamicHoverStyle BackColor="#282B32" ForeColor="White" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="3px" />
<DynamicMenuStyle BackColor="#B5C7DE" />
<DynamicSelectedStyle BackColor="Gray" />
<DynamicItemTemplate>
<%# Eval("Text") %>
</DynamicItemTemplate>
<StaticHoverStyle BackColor="#284E98" ForeColor="White" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="5px" />
<StaticSelectedStyle BackColor="#70788B" />
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server"
ShowStartingNode="False" />
</div>