Embedding Silverlight in an existing application

Posted on 2008-11-11
Medium Priority
Last Modified: 2013-11-12
I have an existing ASP.NET 3.5 application and I have a Silverlight 2 application that I want to use in that existing ASP.NET site.  The test page that was created when I made the silverlight project works fine, however when I put the div and asp:Silverlight tag into another page on my site it stops working.  I do not get any errors, the silverlight app just never loads up.  My site uses master pages and the master page has my ScriptManager object so there is no script manager in the same aspx file as the Silverlight control, however I did try putting a ScriptManagerProxy on the page and that did not help, I also tried removing the script manager from the master page and putting it in the ASPX along with the asp:Silverlight control, but still no success.

How can I get my silverlight application to load in my existing site that uses master pages?

Question by:SkipFire
  • 2

Expert Comment

ID: 23071333
This isn't a solution - I'm having the same problem. I do get IE javascript errors via the little hazard icon in the lower left corner of IE7 when I try to run my aspx page with a masterpage and a Silverlight object. Do you get javascript errors as well?
Error: 'Sys.WebForms.PageRequestManager' is null or not an object
Error: 'Sys.UI.Silverlight' is null or not an object
Error: 'Sys.Application' is null or not an object
Error: 'Sys.UI.DomEvent' is null or not an object

These errors lead me to believe that the correct libraries are not being loaded by the client. This same aspx page and Silverlight app run fine if I use the aspx page as a stand-alone page (i.e. no MasterPage).

Accepted Solution

jeremyeadamich earned 2000 total points
ID: 23072803

I think that you may be having a very different problem than I. I tried building a simple test application with a Silverlight app embedded in a content page. When I ran it, I got no errors and the Silverlight app was not visible.

After digging around, I found that by not using height and width = '100%' in the asp:Silverlight control but using actual pixel measurments, the Silverlight app magically appeared.

Hope this helps you.


<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/TS.master" %>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls" TagPrefix="asp" %>
<asp:content runat="server" ID="content1" ContentPlaceHolderID="ContentPlaceHolder1">
   <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
   <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/Test_Silverlight.xap" MinimumVersion="2.0.31005.0" Width="500px" Height="500px" />

Open in new window


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question