Hide item in the menu large structured

2 posts, 0 answers
  1. Luc Émond
    Luc Émond avatar
    26 posts
    Member since:
    Jun 2010

    Posted 03 Dec 2013 Link to this post

    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
  2. Luc Émond
    Luc Émond avatar
    26 posts
    Member since:
    Jun 2010

    Posted 03 Dec 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top