Click here to Skip to main content
11,641,081 members (65,116 online)
Rate this: bad
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 20:01pm
Edited 2-Oct-12 22: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
0 Mika Wendelius 400
1 OriginalGriff 205
2 DamithSL 203
3 CPallini 145
4 Afzaal Ahmad Zeeshan 129
0 Mika Wendelius 380
1 OriginalGriff 205
2 DamithSL 203
3 CPallini 125
4 Afzaal Ahmad Zeeshan 89

Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2015
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