1
메뉴 모음을 표시하기 위해 asp : Menu를 사용하고 있습니다. 메뉴 컨트롤은 사이트 맵을 데이터 소스로 사용합니다. 이제 권한에 따라 사이트 맵 노드에서 일부 하위 노드를 삭제하려고합니다. Mennuitems를 조작하려고 시도했지만 그 자식 노드를 삭제할 수 없습니다.마스터 페이지의 사이트 맵에서 하위 노드를 제거하십시오.
이이
<siteMapNode url="~/_PL/SPONSOR/Default.aspx" title="SPONSOR" description="SPONSOR">
<siteMapNode url="~/_PL/SPONSOR/Home.aspx" title="HOME" description="HOME" />
<siteMapNode url="~/_PL/SPONSOR/Default.aspx?0" title="Dash Board" description="Dash Board" />
<siteMapNode url="~/_PL/SPONSOR/SiteViewAll.aspx" title="Site Info." description="Site Information" id="Site">
<siteMapNode url="~/_PL/SPONSOR/Site.aspx" title="Add/Update Site Info." description="Add/Update Site Information" id="Add"/>
<siteMapNode url="~/_PL/SPONSOR/SiteViewAll.aspx?0" title="View Site Info." description="View Site Information" />
</siteMapNode>
<siteMapNode url="~/_PL/SPONSOR/UserViewAll.aspx" title="User Info." description="User Info" >
<siteMapNode url="~/_PL/SPONSOR/User.aspx?New" title="Add/Update User Info." description="Add/Update User Information" />
<siteMapNode url="~/_PL/SPONSOR/UserViewHirerchical.aspx" title="View Hirerchical User" description="View Hirerchical User Information" />
<siteMapNode url="~/_PL/SPONSOR/UserViewAll.aspx?0" title="View User Info." description="View User Information" />
</siteMapNode>
<!--<siteMapNode url="~/_PL/SPONSOR/CRFProtocol.aspx" title="CRF Protocol" description="CRF Protocol" />-->
<siteMapNode url="~/_PL/SPONSOR/eCRFDownload.aspx" title="CRF Download Forms" description="CRF Download Forms" />
<siteMapNode url="~/_PL/SPONSOR/LogSheet.aspx" title="Log Sheet" description="Log Sheet" />
<siteMapNode url="~/Default.aspx?logout=SPONSOR" title="Logout" description="Logout" />
</siteMapNode>
내가 권한
<siteMapNode url="~/_PL/SPONSOR/Site.aspx" title="Add/Update Site Info." description="Add/Update Site Information" id="Add"/>
I에 따라 노드 아래에 제거 할 내 사이트 맵의 코드 내 메뉴 컨트롤
<td class="TRMenu" valign="middle" align="left">
<asp:Menu ID="menu" runat="server" CssClass="menu" EnableViewState="False" Orientation="Horizontal"
DataSourceID="newSiteMap">
</asp:Menu>
<asp:SiteMapDataSource ID="newSiteMap" runat="server" ShowStartingNode="False" StartingNodeUrl="~/_PL/SPONSOR/Default.aspx" />
</td>
에 코드입니다 다음과 같은 방법을 시도했습니다.
protected void Page_Unload(object sender, EventArgs e)
{
foreach (MenuItem Item in menu.Items)
{
if (Item.Text.Contains("Site"))
{
string str = Item.ChildItems[0].Text;
Item.ChildItems.RemoveAt(0);
}
}
}
페이지로드 및 프리 렌더링 방법에도 시도했지만 페이지가로드 될 때도 노드가 있습니다.
어떻게 제거 할 수 있습니까?