Click here to Skip to main content
12,819,019 members (26,567 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET Javascript
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
Posted 30-Sep-12 21:01pm
Updated 2-Oct-12 23:19pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100