How to add Silverlight2 to EasyControl?

Topics: Developer Forum
Apr 21, 2009 at 5:56 AM
I am sorry if I put a question which was answered elsewhere (oh I have been searching a lot). My problem is, I want to add a Silverlight app to an EasyControl.

I know that MWPSK is ASP.NET 2.0, so <asp:silverlight> tag is not working, becuase it wants the scriptmanager, which again not in asp.net 2.0. You can enable it by tweaking web.config, but this is not the path which I want...

So I tried the classic <object></object>  tag (stoled it :) form the testpage.html ) in ascx file, which ends with the error that silverlight application can not be downloaded, in javascript console. The paths are correct. I am using the asp.net server within Visual Studio 2008 Express, and I have Silverlight client installed so he definitly knows xap files, again I searched a lot...

So then I tried the javascript way, with inserted silverlight.js a called the function createSilverlight("page.xaml"), which generates the object Silverlight({}), which silently ends, not displaying the app in the easycontrol, but with no errors in the javascript console

So I am desperate, knows anybody how to do it?

thanks



Apr 23, 2009 at 7:28 AM
OK so I found a solution.
I think the ASP.NET/Silverlight/Ajax gurus  out there will not like it, but I think it is not that bad.

First of all MWPSK is asp.net 2.0. Silverlight2 app you can call with <asp:silverlight> tag, but this tag is present in asp.net 3.5. As we know you cannot convert MWPSK to net 3.5, for many reasons...(you can, but then you have make some tweaking)

The obvious think was putting the <object> tag into the ascx control, but this was not working.....

So I tried  to invoked it through javascript, which I put into stringbuilder + clientscript and made page render override, but this did not helped either, I saw the code in page source, but the Silverlight app was not visible in the easycontrol....

Last try was iframe-ing it, and this worked like a charm....

So how to do it...

1. You make you Silverlight2 app, after building you get testpage.html with <object> tag to call the silverlight app, e.b. in silverlightApplication/Bin/Debug/TestPage.html
2. Then you make your EasyControl, and insert only this <iframe src="path to testpage.html of your app"></iframe> a that it is

You can link the Silverlight app to the website, resulting in creation of ClientBin folder, in which the xap file is transered so there you can place the testpage.html a call it from this folder...

I think this is a posibility how to add Silverlight2 functionality to MWPSK without generating tons of code, on the other side without iframes your are lost....