Click here to Skip to main content
15,940,271 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all I have one ASP Menu in which it has some menu items. See below code

<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
                       <asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home"/>
                       <asp:MenuItem NavigateUrl="~/AboutUs.aspx" Text="About"/>
                        <asp:MenuItem NavigateUrl="~/Admin.aspx" Text="Admin"/>
                        <asp:MenuItem NavigateUrl="~/UserAccount.aspx" Text="User"/>

I want to hide or disable 3rd menu item based on login session. I know how to handle session but I am not right with how to hide one asp:menu item. I can't apply CSS to single Menu Item.
So friends Please tell me what to do
Updated 2-Oct-12 22:19pm

1 solution

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim whologged As String
        whologged = HttpContext.Current.User.Identity.Name
        If whologged <> "admin" Then
        End If

End Sub

Just got this working, couldn't find this no where on the internet. Hope it works for you.
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