disable radmenu dropdown button on master page

4 posts, 0 answers
  1. Code
    Code avatar
    9 posts
    Member since:
    Aug 2013

    Posted 07 Aug 2013 Link to this post

    Hi 

    I'm using .net 2.0 and vb.net , web forms

    On my master page there is a radmenu. This menu has 4 buttons that if you hover over any of them then , then a drop down will appear. and each drop down has 1 to 5 buttons.  example below

    ......home...... menu1........menu 2.......menu3.....menu4
                          a                 t                  s             v
                          b                                    w                    
                          c                                    q
                          d
                          e


    my question is:

    from the code behind on my .aspx page, how do I disable "menu1" and all its buttons.

    I still want to see it  but just it must not link.

    right now I have this   


    Partial Class _Default
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

    Me.FindControl("Mymenu").Visible = True

              'how do I disable "menu1" and all its buttons.

            Dim m As Telerik.Web.UI.RadMenu = CType(MyBase.Master.FindControl("Mymenu"), Telerik.Web.UI.RadMenu)

            m.item find("menu1").Disable()


        End Sub
    End Class




  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Aug 2013 Link to this post

    Hi,

    Please try the following code snippet that I have tried to disable a RadMenuItem from Code behind.

    VB:
    Protected Sub Page_Load(sender As Object, e As EventArgs)
        Dim menu As Telerik.Web.UI.RadMenu = DirectCast(MyBase.Master.FindControl("RadMenu1"), Telerik.Web.UI.RadMenu)
        menu.FindItemByText("Menu1").Enabled = False
    End Sub

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Code
    Code avatar
    9 posts
    Member since:
    Aug 2013

    Posted 08 Aug 2013 Link to this post

    Thanks for the reply but I get an error saying that 

    Object reference not set to an instance of an object.

    and it is not happy with this line  menu.FindItemByText("Menu1").Enabled = False

    the name "Menu1" is correct


    Thanks for your help

  5. Code
    Code avatar
    9 posts
    Member since:
    Aug 2013

    Posted 08 Aug 2013 Link to this post

    Hi I got your code to work - thanks -

    I had to put the code in the "Page_LoadComplete" function

    Thanks
Back to Top