disable a radmenu button from javascript that is called from the vb.net page load function

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

    Posted 12 Aug 2013 Link to this post

    I am trying to make it that on page load in the code behind, I disable a button in the radmenu using javascript

    the error is : cant find object - $find('myRadMenu') and the name is correct, so it has something todo with when the radmenu is rendered so I tried a wrap my script in a document.ready but that also won't work

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    
    ClientScript.RegisterStartupScript(Me.GetType(), "test", "<script type='text/javascript'> $find('myRadMenu').findItemByText('MyButton').disable(); </script>")
    
    End Sub

    Do you know how to disable a radmenu button from javascript that is called from the vb.net page load function.

    It must be done this way as I have other javascript that needs to fire

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

    Posted 12 Aug 2013 Link to this post

    Hi Code,

    Please have a look at the following code I tried which works fine at my end.

    C#:
    Protected Sub Page_Load(sender As Object, e As EventArgs)
        Dim script As String = "function f(){disableMenu(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);"
        ScriptManager.RegisterStartupScript(Page, Page.[GetType](), "key", script, True)
    End Sub

    JavaScript (defined in ASPX):
    <script type="text/javascript">
        function disableMenu() {
            $find('myRadMenu').findItemByText('MyButton').disable();
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top