Click here to Skip to main content
15,888,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have a menu as in front end as below:

XML
<asp:Menu ID="Menu1" Width="100%" Orientation="Horizontal" runat="server" BackColor="#F7F6F3"
                            DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Verdana"
                            Font-Size="0.8em" ForeColor="#7C6F57" StaticSubMenuIndent="10px">
        <StaticSelectedStyle BackColor="#5D7B9D" />
        <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
        <DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
        <DynamicMenuStyle BackColor="#F7F6F3" />
        <DynamicSelectedStyle BackColor="#5D7B9D" />
        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
        <StaticHoverStyle BackColor="#7C6F57" ForeColor="White" />
        <Items>
            <asp:MenuItem NavigateUrl="~/TeamLeader/Home.aspx" Text="Home" Value="Home">
            </asp:MenuItem>
            <asp:MenuItem Text="Attendance Report" Value="Reports">
                <asp:MenuItem NavigateUrl="~/TeamLeader/NewAttendanceReport.aspx"
                    Text="Attendance Report" Value="Attendance Report"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/TeamLeader/LateComer.aspx" Text="Late Coming Report"
                    Value="Late Comer Report"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/TeamLeader/DailMovementLog.aspx"
                    Text="Daily Movement Log Report" Value="Daily Movement Log Report">
                </asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/TeamLeader/MeetingReport.aspx" Text="Official Meeting Report"
                    Value="Officia lMeeting"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/TeamLeader/LunchReport.aspx" Text="Lunch Report"
                    Value="Lunch Report"></asp:MenuItem>
            </asp:MenuItem>
            <asp:MenuItem Text="Leave Reports" Value="Leave Reports">
                <asp:MenuItem NavigateUrl="~/TeamLeader/LeaveReport.aspx" Text="Leave Report"
                    Value="Leave Report"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/TeamLeader/AllotedLeave.aspx"
                    Text="Allotted Leave Report" Value="Allotted Leave Report"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/TeamLeader/ApprovalReport.aspx"
                    Text="Approved/Disapproved Leave Report"
                    Value="Approved/Disapproved Leave Report"></asp:MenuItem>
            </asp:MenuItem>
            <asp:MenuItem Text="Employee Report" Value="Employee Report">
                <asp:MenuItem NavigateUrl="~/TeamLeader/LeaveReportofEmployee.aspx"
                    Text="Employee Leave Report" Value="Employee Leave Report"></asp:MenuItem>
                <asp:MenuItem NavigateUrl="~/TeamLeader/AvailableLeaveReport.aspx"
                    Text="Available Leave Report" Value="Available Leave Report"></asp:MenuItem>
            </asp:MenuItem>
            <asp:MenuItem NavigateUrl="~/TeamLeader/ChangePassword.aspx" Text="Change Password"
                Value="Change Passowrd"></asp:MenuItem>
            <asp:MenuItem NavigateUrl="~/TeamLeader/Logoutt.aspx" Text="Logout" Value="Logout">
            </asp:MenuItem>




Now I want to hide some sub-menus from code behind .

Please let me know how to solve this problem.
Posted
Updated 12-Oct-17 0:04am

Here you go.

How to enable, disable Menu programmatically[^]

Free attachment

ASP.NET Menu Examples[^](Around 35 examples about Menu control)
 
Share this answer
 
Comments
Monjurul Habib 17-Jun-11 17:22pm    
nice links, my 5.
hi all
for menu
mnu.Items[1].Enabled = false;

for submenu
mnu.Items[1].ChildItems[0].Enabled = false;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900