Skip to main content

Microsoft Silverlight

Unanswered Question Placing Silverlight User Control into ASP.NET PageRSS Feed

(0)

tau-neutrino
tau-neut...

Member

Member

0 points

3 Posts

Placing Silverlight User Control into ASP.NET Page

I'm trying to place a silverlight user control that i've created into an ASP.NET page. I want to be able to access the silverlight app's methods. How do I do this?

I was trying to go about doing his by using the <asp:xaml control but I seem to be missing something.

 Can anyone point me in the right direction?

 

P.S. I'd post error messages that I'm getting but I'm afraid every time I try somethign new I get a different message.

tau-neutrino
tau-neut...

Member

Member

0 points

3 Posts

Re: Placing Silverlight User Control into ASP.NET Page

Let me provide a little bit more information. I'm using VS2008. I have a Test1Website that I added to my c# silverlight solution Test1.

 The code I am using in the default.aspx page is:

<asp:Silverlight ID="Silverlight1" source="~/Page.xaml"

runat="server" Height="100px" Width="100px">

</asp:Silverlight>

This is the error message that is generated when I build. 

Microsoft JScript runtime error: Sys.InvalidOperationException: Invalid XAML for control 'Silverlight1'. [Page.xaml] (line 4, col 29): XamlReader.Load() does not support x:Class.

In my Page.xaml file I have this declaration.

<UserControl xmlns:my2="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Extended" xmlns:my1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended" x:Class="Test1.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Width="400" Height="300">

 This is wrapped around a grid and a canvas that I am using.

 

 

SteveWong
SteveWong

Contributor

Contributor

6343 points

1,281 Posts

Re: Placing Silverlight User Control into ASP.NET Page

tau-neutrino:

<asp:Silverlight ID="Silverlight1" source="~/Page.xaml"

runat="server" Height="100px" Width="100px">

</asp:Silverlight>

 This is wrapped around a grid and a canvas that I am using.

Try this After you built your solution

<asp:Silverlight ID="Silverlight1" source="~/ClientBin/Test1.xap"

runat="server" Height="100px" Width="100px">

</asp:Silverlight>

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

Client App Dev

tau-neutrino
tau-neut...

Member

Member

0 points

3 Posts

Re: Placing Silverlight User Control into ASP.NET Page

 

SteveWong:
tau-neutrino:

<asp:Silverlight ID="Silverlight1" source="~/Page.xaml"

runat="server" Height="100px" Width="100px">

</asp:Silverlight>

 This is wrapped around a grid and a canvas that I am using.

Try this After you built your solution

<asp:Silverlight ID="Silverlight1" source="~/ClientBin/Test1.xap"

runat="server" Height="100px" Width="100px">

</asp:Silverlight>

 I attempted this solution  but I received the following error message.

 Microsoft JScript runtime error: Sys.InvalidOperationException: InitializeError error #2104 in control 'Silverlight2': Could not download the Silverlight application. Check web server settings

The project I am using contains one solution with two projects in it. The silverlight project where I designed my code and the web site which I was attempting to use it on. They do seem to be linked in the soluion explorer.

Kiril_Iliev
Kiril_Iliev

Member

Member

48 points

32 Posts

Re: Placing Silverlight User Control into ASP.NET Page

Hi Tau,

Here is my way to do it:

ASP.NET page - fully customizable by the user.

<DNzone:Silverlight ID="Xaml1" runat="server"

Source="~/ClientBin/dnMultimediaPlayer.xap"

InitParameters="m=prlady.wmv,control=skin2"

MinimumVersion="2.0.30523"

Width="100%" Height="100%" />

InitParameters is used to set my code behind stuff like media source, and UserControl (or the look of the media - if it will be either glossy or classic, or whatever the designers thought of).

And as mentioned above - do NOT use Canvas... Grid is your friend. ;)

Should you need more help, just ask.

EDIT: Oh, DNzone is just my namespace of my reusable control. Usually it is asp - so dont be confused by that.

===================================
Research and Development Manager
Dynamic Zones
http://www.dnzone.com/

ivanatilca
ivanatilca

Member

Member

113 points

110 Posts

Re: Placing Silverlight User Control into ASP.NET Page

Having the same problem!!!

I compile my website and try to run it on IIS7 but this appears...

 errors

any help?

 

 

Ivana A. Tilca | Microsoft Student Partner | Channel 8 editor | Microsoft

http://ivanatilca.com.ar

SteveWong
SteveWong

Contributor

Contributor

6343 points

1,281 Posts

Re: Re: Placing Silverlight User Control into ASP.NET Page

Did you built your solution and put under the folder <root>/ClientBin/

Regards,
SteveWong (HongKong)
Please mark post as answer if they help you

Client App Dev

Kiril_Iliev
Kiril_Iliev

Member

Member

48 points

32 Posts

Re: Placing Silverlight User Control into ASP.NET Page

 @ Ivana

Did you allow in your mime-types of IIS 7 xap extension?

===================================
Research and Development Manager
Dynamic Zones
http://www.dnzone.com/

John Rzeszotarski
John Rze...

Member

Member

15 points

10 Posts

Re: Placing Silverlight User Control into ASP.NET Page

This corrected my issue. Thanks

krstd
krstd

Member

Member

2 points

1 Posts

Re: Placing Silverlight User Control into ASP.NET Page

내가 찾던 답이네요...

Thank you.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities