Select to view content in your preferred language

Passing Data To/From Application

676
2
10-06-2010 08:53 AM
PaulHuppé
Deactivated User
Hi,

I have a small Silverlight map application that I call from an ASP.NET web page using using the "object" tag as follows:

        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="590" height="300">
    <param name="source" value="ClientBin/MapViewer.xap"/>
    <param name="onError" value="onSilverlightError" />
    <param name="background" value="white" />
    <param name="minRuntimeVersion" value="4.0.50401.0" />
    <param name="autoUpgrade" value="true" />
                  <param name="initParams" value="<%= lang %>" />


I have figured out how to pass parameters to the application using the "param" parameter of the "object" tag.  Now, I need to do the reverse.  I need to have the Silverlight application either set the value of a textbox for example, on the ASP.NET parent page, or find some other way to send data back to the parent page.  As anyone done this before?

Thanks,
Paul
0 Kudos
2 Replies
DanielWalton
Frequent Contributor
You can do it using Javascript and Silverlight's HtmlPage class. Here is a blog post explaining how to do it:

http://geekswithblogs.net/PeterTweed/archive/2009/08/08/html-bridge---silverlight-javascript-interop...
0 Kudos
PaulHuppé
Deactivated User
Wow, great article. Exactly what I needed.
Thanks,
Paul
0 Kudos