This is a migrated thread and some comments may be shown as answers.

Hide item in the menu large structured

1 Answer 33 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Luc Émond
Top achievements
Rank 1
Luc Émond asked on 03 Dec 2013, 12:39 PM
Hi,
I'am using this menu :
http://demos.telerik.com/aspnet-ajax/menu/examples/megadropdown/defaultcs.aspx

Is there a way to hide an item in the products section.
I would like to hide items base on the permission level.

Exemple if your not an admin i would hide sofas and Beds in the products menu.

Tks

Luc

1 Answer, 1 is accepted

Sort by
0
Luc Émond
Top achievements
Rank 1
answered on 03 Dec 2013, 01:20 PM
I found a way

Private Sub RadMenu1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadMenu1.Load
        Dim menuItem As RadMenuItem = RadMenu1.FindItemByText("Products")
        Dim _RadSiteMap As RadSiteMap = CType(RecursiveFindControl(Page, "RadSiteMap1"), RadSiteMap)
         _RadSiteMap.Nodes.FindNodeByText("Furniture").Visible = False
'or
        _RadSiteMap.Nodes.FindNodeByText("Furniture").Nodes.FindNodeByText("Sofas").Visible = False
 
    End Sub
 
Public Function RecursiveFindControl(ByVal container As Control, ByVal name As String) As Control
        If Not (container.ID Is Nothing) AndAlso (container.ID.Equals(name)) Then
            Return container
        End If
 
        For Each c As Control In container.Controls
            Dim ctrl As Control = RecursiveFindControl(c, name)
            If Not ctrl Is Nothing Then
                Return ctrl
            End If
        Next
        Return Nothing
    End Function
Tags
Menu
Asked by
Luc Émond
Top achievements
Rank 1
Answers by
Luc Émond
Top achievements
Rank 1
Share this question
or