Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JavascriptASP:NET
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">
                    <items>
                        <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"/> 
                    </items>

 
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
Ganeshcse1.9K
Edited 2-Oct-12 22:19pm
DaveAuld158.2K
v3

1 solution

Rate this: bad
good
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
            TopMenu.Items.RemoveAt(2)
        End If
 
End Sub
 
Just got this working, couldn't find this no where on the internet. Hope it works for you.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,628
1 Tadit Dash 375
2 Manas Bhardwaj 319
3 Sergey Alexandrovich Kryukov 275
4 OriginalGriff 243
0 Sergey Alexandrovich Kryukov 9,530
1 OriginalGriff 5,711
2 Peter Leow 4,320
3 Maciej Los 3,540
4 Abhinav S 3,373


Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid