Silverlight 3 - update IFrame

I have an ASP.NET application with DIV and IFRAME. The DIV contains my Silverlight application. IFRAME points to another page on my site. When a user clicks on a button in my Silverlight application, I try to set the value in a hidden field on the page to an IFRAME and submit the page.

I am currently calling a JavaScript function on the page that hosts my Silverlight application. I am trying to use a JavaScript function to then interact with a page in an IFRAME via the HTML DOM. Oddly enough, whenever I access a document element on a FRAME object, a message is returned to my Silverlight application that reads:

"Type 'slBridge' does not exist. Parameter name: typeName"

Here is the code that calls a JavaScript function in a Silverlight application.

HtmlPage.Window.CreateInstance("slBridge", new string[] { });

      

Here is my JavaScript code:

  function slBridge() {
    alert("Getting to execute JS");
      for (i = 0; i < window.frames.length; i++) {
        if (window.frames[i].name == "bridgeIFrame") {
        alert(windows.frames[i].document.title);      // If I remove this line it works. I can print the value of "i" as well
        break;
      }
    }                                
  }     

      

Are there any security things that I am not aware of? If so, how do I access the IFrame from my SL app?

thanks

+2


a source to share


2 answers


Dim domelement As HtmlElement = System.Windows.Browser.HtmlPage.Document.GetElementById("iframe")
    If domelement.GetStyleAttribute("visibility") = "visible" Then
        domelement.SetStyleAttribute("zIndex", "3")
    End If

      



example of changing iframe to dom from SL

+2


a source


I'm not sure why you are using CreateInstance

. To call the function use Invoke

: -



 HtmlPage.Window.Invoke("slBridge");

      

0


a source







All Articles