Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Placing Silverlight User Control into ASP.NET Page
9 replies. Latest Post by krstd on January 15, 2009.
(0)
tau-neut...
Member
0 points
3 Posts
06-16-2008 4:10 PM |
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.
06-16-2008 4:36 PM |
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:
<
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
Contributor
6343 points
1,281 Posts
06-16-2008 8:28 PM |
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.
<asp:Silverlight ID="Silverlight1" source="~/Page.xaml"
Try this After you built your solution
<asp:Silverlight ID="Silverlight1" source="~/ClientBin/Test1.xap"
06-17-2008 9:27 AM |
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
48 points
32 Posts
06-17-2008 10:07 AM |
Hi Tau,
Here is my way to do it:
ASP.NET page - fully customizable by the user.
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.
ivanatilca
113 points
110 Posts
06-17-2008 7:23 PM |
Having the same problem!!!
I compile my website and try to run it on IIS7 but this appears...
any help?
06-18-2008 7:50 AM |
Did you built your solution and put under the folder <root>/ClientBin/
06-18-2008 9:53 AM |
@ Ivana
Did you allow in your mime-types of IIS 7 xap extension?
John Rze...
15 points
10 Posts
06-19-2008 2:22 PM |
This corrected my issue. Thanks
krstd
2 points
1 Posts
01-15-2009 9:39 PM |
내가 찾던 답이네요...
Thank you.