Home > failed to > failed to invoke error in silverlight

Failed To Invoke Error In Silverlight

here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up When calling Javascript function from Silverlight, I get error “failed to invoke” the function up vote 2 down vote favorite I am calling a JavaScript function from Silverlight. My JavaScript file is as follows: function sayHello() { alert("Hello from Silverlight via Javascript"); } function showText(mytxt) { alert(mytxt); } In my Silverlight .cs file, I have 2 event handlers for 2 different buttons. Button1's event handler invokes sayHello(). This works perfect. Button2's event handler invokes showText() and this one fails with error "failed to invoke showText". Following is my codeline from Silverlight. void myButtonClickEvent(object sender, RoutedEventArgs e) { HtmlPage.Window.Invoke("showText", "show this text"); } I am new to client side programming. Appreciate your help with this. javascript silverlight share|improve this question asked Nov 21 '12 at 5:01 Betty Thomas 3114 Stab in the dark: does this work? HtmlPage.Window.Invoke("showText", new object[] { "show this text" }); –McGarnagle Nov 21 '12 at 5:12 I tried it. It did not work. I am geting the same error: "failed to invoke ShowText". Any other suggestions? –Betty Thomas Nov 21 '12 at 17:42 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote I got this working. The problem was, the JavaScript file got cached. After I added the new method showText, I compiled it and tested it again. But the JavaScript file did not get updated, so my Silverlight application could not find the new JavaScript method showText. Clearing browser cache and Silverlight cache did not help. To get around the problem, I renamed the JavaScript file and recompiled it. This time the method got called with the parameter. I still need to figure out how to update the JavaScript file after making changes. I am building the JavaScript file as a resource of the dll. share|improve this answer answered Nov 27 '12 at 6:22 Betty Thomas 3114 add a

SQL Server 2014 Express resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference Dev centers Retired content Samples We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. Ask a question Quick access Forums home Browse forums http://stackoverflow.com/questions/13486644/when-calling-javascript-function-from-silverlight-i-get-error-failed-to-invoke users FAQ Search related threads Remove From My Forums Answered by: Failed to invoke-- Error message Silverlight > Getting Started with Silverlight Question 0 Sign in to vote hi all i m getting failed to invoke message. I have javascript function on aspx page. In my https://social.msdn.microsoft.com/Forums/en-US/72448c6d-960d-4b54-9be4-f242eca81958/failed-to-invoke-error-message?forum=silverlightstart xaml file i m call this function i have import the System.windows.browser namespace I called the function using HTMLPage.Window.invoke("abc","12","12") The javascript function function abc(parm1,parm2) { // code } Thursday, December 24, 2009 7:49 AM Reply | Quote Answers 0 Sign in to vote That's strange. Here an example that works for me: <%@ Page Language="C#" AutoEventWireup="true" %> SilverlightApplication33

 

© Copyright 2019|winbytes.org.