none
How add SilverLight(C#) in aspx page

    Question

  • How add SilverLight(C#) in aspx page!
    I have page.xaml and page.xaml.cs, when I adding <asp:xaml> I get error in JavaScript

    Monday, February 11, 2008 6:52 PM

Answers

  • I get error in JavaScript
     

    If you want to use XAML control, you need to have ASP.NET 3.5 extension in your machine. then, you can use Silverlight control in aspx page of ASP.NET 3.5 extension web application.

    Example ~  

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
         <asp:ScriptManager runat="server" ID="ScriptManager" />
            <asp:Silverlight runat="server" ID="silverlightLayout" InstallationMode="Inline" Version="1.1" Source="Page.xaml"
                EnableHtmlAccess="true" Windowless="true" Width="844" Height="472" PluginBackColor="Transparent" />

        </div>
        </form>
    </body>
    </html>

    Hope it helps.  

    Monday, February 11, 2008 9:05 PM

All replies

  • I get error in JavaScript
     

    If you want to use XAML control, you need to have ASP.NET 3.5 extension in your machine. then, you can use Silverlight control in aspx page of ASP.NET 3.5 extension web application.

    Example ~  

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
         <asp:ScriptManager runat="server" ID="ScriptManager" />
            <asp:Silverlight runat="server" ID="silverlightLayout" InstallationMode="Inline" Version="1.1" Source="Page.xaml"
                EnableHtmlAccess="true" Windowless="true" Width="844" Height="472" PluginBackColor="Transparent" />

        </div>
        </form>
    </body>
    </html>

    Hope it helps.  

    Monday, February 11, 2008 9:05 PM
  • Thank you! It's work  Smile

    Tuesday, February 12, 2008 8:58 PM
  •  Hi , i must be doing something wrong, but for some reason when i try to do what it says here, i get the following error on the "asp:Silverlight" tag.

    Unknown server tag 'asp:Silverlight'.   

     

    Any thoughts?

     

    Tuesday, February 19, 2008 9:30 AM
  • Unknown server tag 'asp:Silverlight'. 

    Its because you haven't installed ASP.NET 3.5 extension yet.

    Please download ASP.NET 3.5 extension and install it on your machine. (Ensure that your installation is successful.)

    After that, you have to create "ASP.NET 3.5 Extension Web Application" instead of normal web application or project.

    Tuesday, February 19, 2008 12:29 PM
  •  It worked fine for me!

     I already had the ASP.NET 3.5 framework installed and therefore i didn't pay any more atention to that matter anymore.

     

    It solved me a lot of issues, thanks a lot!
     

    Wednesday, February 20, 2008 10:14 AM
  • Hey there,

    I'm also getting the Unknown server tag 'asp:Silverlight' error in IE when trying to view my test .aspx Silverlight page.  However, I installed all of the components for the new Silverlight 2 beta including the Silverlight Tools Beta 1 for Visual Studio 2008 package - which, according to this page, includes the ASP.NET 3.5 extension package you're mentioning.  Should I be installing a different extension package?  Thanks in advance for any info you can provide!

    Thursday, March 20, 2008 8:44 PM
  • There is a new asp:Silverlight tag that comes in the Silverlight 2 SDK; you shouldn't be required to have the ASP.NET extensions (AFAIK there's no harm though).  When you create a Silverlight application and a hosting website, you should see a testpage that has the following line in the ASP markup:

     <%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
        TagPrefix="asp" %>

    There will also be System.Web.Silverlight.dll added to the Bin folder of the website.  Do you have both of these?  If not, is this website created alongside a Silverlight Application, or is it a pre-existing site?  If pre-existing, how did you add the Silverlight to it?

    Thursday, March 20, 2008 10:26 PM
  • Okay, it appears as though I do have the register assembly code AND the dll.  Any other thoughts?  Oh, and this is a new Silverlight app that I'm building from a stutorial.  BTW, many thanks for taking the time to respond!
    Friday, March 21, 2008 9:10 PM
  • i have create i silverlight project and web site. silverlightproject created SilverlightApplication1TestPage.aspx. but i want to use it in Default.aspx (i have also default.aspx.cs). Bu page seems blank??

    Wednesday, July 08, 2009 7:42 AM
  • WebApplication1._

     

    what  is WebApplication1.Default?

    do i have to include all the xaml files in my asp website.

    Wednesday, April 27, 2011 1:17 AM
  • Hi,

    Actually i have installed .Net 3.5 framework installed and also using the latest version of VS [VS 2008]. But still having problem that can't find <asp:Silverlight > tags

    Waiting for your reply.

    Thanks

    Wednesday, November 09, 2011 4:35 AM