How to call javascript functions in silverlight.
-
Hi, I am working on a silverlight application. In this I created a silverlight page named Page.xaml. Then this silverlight page is used or embedded in a aspx page named Home.aspx. In Home.aspx I wrote javascript function. This javascript function should be called whenever I click on the button in Page.xaml. i.e., on clicking a button in Page.xaml I have to call the javascript function in Home.xaml provided Page.xaml is in Home.aspx and all these are in a same project. If anyone have any idea to do this please reply me. Thanks in advance.
-
Hi, I am working on a silverlight application. In this I created a silverlight page named Page.xaml. Then this silverlight page is used or embedded in a aspx page named Home.aspx. In Home.aspx I wrote javascript function. This javascript function should be called whenever I click on the button in Page.xaml. i.e., on clicking a button in Page.xaml I have to call the javascript function in Home.xaml provided Page.xaml is in Home.aspx and all these are in a same project. If anyone have any idea to do this please reply me. Thanks in advance.
-
Hi, I am working on a silverlight application. In this I created a silverlight page named Page.xaml. Then this silverlight page is used or embedded in a aspx page named Home.aspx. In Home.aspx I wrote javascript function. This javascript function should be called whenever I click on the button in Page.xaml. i.e., on clicking a button in Page.xaml I have to call the javascript function in Home.xaml provided Page.xaml is in Home.aspx and all these are in a same project. If anyone have any idea to do this please reply me. Thanks in advance.
Also, there's documentation... HTML Bridge: Interaction Between HTML and Managed Code[^]
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Hi, I am working on a silverlight application. In this I created a silverlight page named Page.xaml. Then this silverlight page is used or embedded in a aspx page named Home.aspx. In Home.aspx I wrote javascript function. This javascript function should be called whenever I click on the button in Page.xaml. i.e., on clicking a button in Page.xaml I have to call the javascript function in Home.xaml provided Page.xaml is in Home.aspx and all these are in a same project. If anyone have any idea to do this please reply me. Thanks in advance.
Hi Nekkantidivya, Use HtmlPage.Window.Invoke() method to give the JavaScript call from your silverlight application. Suppose the name of your javascript method is: SayHello(), then call the following from your button click event implementation: HtmlPage.Window.Invoke("SayHello"); Let me know if you have any issues.
Regards, - Kunal Chowdhury (My Blog)