Embedding Silverlight in an existing application

Posted on 2008-11-11
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
    LVL 3

    Expert Comment

    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).
    LVL 3

    Accepted Solution


    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

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    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.…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    733 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now