Skip to main content

Microsoft Silverlight

Answered Question problem calling javascript function from silverlightRSS Feed

(0)

Jugano
Jugano

Member

Member

2 points

24 Posts

problem calling javascript function from silverlight

i have created below function in default.aspx function test() { //return (i + j); alert('hello'); } when i calling it from button click event in silverlight Invoke method keep failing, i don't know why can anybody will help me on this private void Button_Click(object sender, RoutedEventArgs e) { HtmlPage.Window.Invoke("test"); } thnak

Sergey.Lutay
Sergey.L...

Contributor

Contributor

7198 points

1,340 Posts

Re: problem calling javascript function from silverlight

Hi,

I have that error when I opens Silverlight application over phisical path(there are not http address to page with Sivlerlight application).

All good, when I opens SL application over http.

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)

Blog

Twitter

Sincerely,
Sergey Lutay

Jugano
Jugano

Member

Member

2 points

24 Posts

Re: Re: problem calling javascript function from silverlight

can you explain it in detail. you i have to access it trough IIS not directly from visual studio. THanks

Sergey.Lutay
Sergey.L...

Contributor

Contributor

7198 points

1,340 Posts

Re: Re: problem calling javascript function from silverlight

I have an error "Failed to Invoke" when opens an application in browser over D:\...\Bin\Debug\TestPage.html

All good if I opens in browser over http://localhost:46935/SilverlightApplication7TestPage.html

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)

Blog

Twitter

Sincerely,
Sergey Lutay

Jugano
Jugano

Member

Member

2 points

24 Posts

Re: Re: Re: problem calling javascript function from silverlight

even this is failing for me too http://localhost:46935/SilverlightApplication7TestPage.html

Amanda Wang - MSFT
Amanda W...

All-Star

All-Star

17241 points

1,466 Posts

Answered Question

Re: Re: Re: problem calling javascript function from silverlight

 Hi Jugano,

Based on your first post, you said created javascript function in the default.aspx, BUT in your last post, from the url we can see, you are runing the testpage.html, so we guess this may be the cause of your proble.

Try to set the default.aspx page as start page, and then run your application to see if the error still there.

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities