在母版页中:
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" Width="60%"
BackColor="#336699" Font-Bold="True"
ForeColor="White">
<StaticMenuStyle BackColor="#336699" />
<StaticSelectedStyle BackColor="#336699" />
<StaticMenuItemStyle BackColor="#336699" />
<DynamicHoverStyle BackColor="#336699" />
<DynamicMenuStyle BackColor="#336699" />
<DynamicMenuItemStyle BackColor="#336699" />
<StaticHoverStyle BackColor="#336699" />
<Items>
<asp:MenuItem Text="Dashboard" NavigateUrl="~/Timecard/Dashboard.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Timecard" NavigateUrl="~/Timecard/TimeCardEntry.aspx">
</asp:MenuItem>
<asp:MenuItem Text="Reports">
<asp:MenuItem Text="Employee Time card Report" NavigateUrl="~/Reports/Employee_Timecard .aspx"></asp:MenuItem>
<asp:MenuItem Text="Employee Leave Detail Report" NavigateUrl="~/Reports/Employee Leave Details.aspx"></asp:MenuItem>
<asp:MenuItem Text="Project wise Report" NavigateUrl="~/Reports/ProjectWise.aspx"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Master">
<asp:MenuItem Text="Company" NavigateUrl="~/Admin/CompanyList.aspx"></asp:MenuItem>
<asp:MenuItem Text="Designation" NavigateUrl="~/Admin/DesignationList.aspx"></asp:MenuItem>
<asp:MenuItem Text="Task" NavigateUrl="~/Admin/TaskList.aspx"></asp:MenuItem>
<asp:MenuItem Text="Project" NavigateUrl="~/Admin/ProjectList.aspx"></asp:MenuItem>
<asp:MenuItem Text="Employee" NavigateUrl="~/Admin/EmployeeList.aspx"></asp:MenuItem>
<asp:MenuItem Text="Employee Transfer/Promotion" NavigateUrl="~/Admin/EmployeeTransferList.aspx"></asp:MenuItem>
<asp:MenuItem Text="Holiday" NavigateUrl="~/Admin/HolidayList.aspx"></asp:MenuItem>
</asp:MenuItem>
</Items>
</asp:Menu>
我想在代码隐藏中禁用报告和主菜单。我必须检查它是否是管理员。如果用户处于管理员状态意味着所有菜单项都应该显示,如果用户不是管理员意味着我必须为报告和主菜单设置 visible=false。请帮我。