Solved

Call Javascript Method from Silverlight version 5

Posted on 2014-01-13
2
464 Views
Last Modified: 2014-01-14
Hi Experts,

I need to run a Javascript function from Silverlight environment. For this, I'm using the "HtmlPage.Document.Invoke" command, but I get the erro "Failed to Invoke: ...".

To illustrate my problem I put a small application in this link. The error occurs when click the button "Execute".

What am I doing wrong?

Thanks in advance,

Marcelo Camarate
0
Comment
Question by:Marcelo Camarate
2 Comments
 
LVL 16

Accepted Solution

by:
Imran Javed Zia earned 500 total points
Comment Utility
Hi,

there were two errors. type="text/javascript2" it is type="text/javascript"


<script type="text/javascript">
        function Executar(param) {
            document.getElementById("txtData").value = param;
        }
    </script>


secondly  use HtmlPage.Window.Invoke not HtmlPage.Document.Invoke

 Private Sub Executa_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
        HtmlPage.Window.Invoke("Executar", DataText.Text)
        DataText.Text = ""
    End Sub


Thanks
0
 

Author Closing Comment

by:Marcelo Camarate
Comment Utility
Hi Imran,

Thanks for your reply. It's work fine now.

Regards,

Marcelo Camarate
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now