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

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

1 Answer 113 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Code
Top achievements
Rank 1
Code asked on 12 Aug 2013, 11:09 AM

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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 12 Aug 2013, 12:28 PM
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.
Tags
Menu
Asked by
Code
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or