Hi
Sir ,I have written code for menu with web.sitemap and SiteMapDataSource1.I want to hide the admin panel if user has no admin rights.
How there is relation between sitemapdatasource,web.sitemap and menu.Please explain me.
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
<asp:Menu ID="Menu" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
OnMenuItemDataBound="OnMenuItemDataBound" onmenuitemclick="Menu_MenuItemClick" Width="100%">
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="main_menu" />
<asp:MenuItemStyle CssClass="level_menu" />
</LevelMenuItemStyles>
</asp:Menu>
----
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="Home" description="">
<siteMapNode url="PendingWork.aspx" title="My Followup" description="My Followup" />
<siteMapNode url="javascript:;" title="Customer" description="Customer">
<siteMapNode url="CustomerList.aspx" title="Customer List" description="Customer List Page"></siteMapNode>
<siteMapNode url ="CustomerDetails.aspx" title="Add Customer" description="New Customer"></siteMapNode>
</siteMapNode>
<siteMapNode url="Default.aspx" title="Admin Panel" description="Admin Panel" />
</siteMapNode>
</siteMap>
on menuitemdatabound()
string strQtyString = "select UNo,URights from UserRights where UNo=" + Session["UNo"] + "";
SqlCommand cmd = new SqlCommand(strQtyString);
DataTable dt = GetData(cmd);
foreach (DataRow row in dt.Rows)
{
if (row["URights"].ToString() != "1")
{
//for removing admin panel
}
}
Thanks
Chandran