Skip to main content
Home Forums General Silverlight Getting Started Two ways of putting silverlight in a page
2 replies. Latest Post by sladapter on July 6, 2008.
(0)
bertpu
Member
72 points
69 Posts
07-05-2008 11:33 PM |
Hello,
I saw two ways of putting silverlight in a page.
One way is to use a object tag like this:
<object data="data:application/x-silverlight," type="application/x-silverlight-2-b1" width="100%" height="100%"> <param name="source" value="ClientBin/Test.xap"/> <param name="onerror" value="onSilverlightError" /> <param name="background" value="white" /> <a href="http://go.microsoft.com/fwlink/?LinkID=108182" style="text-decoration: none;"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/> </a> </object>
The other is to use script manager and silverlight control:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div style="height:100%;"> <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/LessonPlayer.xap" Version="2.0" Width="320px" Height="278px" />
What is the difference between the two ways?
Thanks.
texmex5
Contributor
2239 points
382 Posts
07-06-2008 3:43 AM |
There is also a third option - use createSilverlight() from Silverlight.js
I haven't used ASP a lot so I cannot comment on that alot, but I think there probably isn't a big difference, if at all.
But consirning JavaScript vs. object tag I can say the following.
Also have a look at these documents from msdn:
Hope this helps.
sladapter
All-Star
17439 points
3,172 Posts
07-06-2008 3:32 PM |
No major difference. The second method is only for ASPX page. The ASPX page will use that asp:Silverlight .Net object to generate the HTML code like that in your first method. So basically you still get the same object tag in your page.