Skip to main content
Home Forums Silverlight Programming Programming with JavaScript Silverlight Control not rendering in div tag using firefox
8 replies. Latest Post by Jonathan Shen – MSFT on July 3, 2009.
(0)
karthikn87
Member
0 points
5 Posts
06-27-2009 6:33 AM |
Hi,
I created a Silverlight app and rendered it in the div tag. Now i need to hide the div tag on a Hide button click and show it on a show button click. This works fine in internet explorer but in firefox while showing the div tag, the silverlight control is not rendering( A white screen appears). I know this problem is already reported in many sites...but none of the solution works for me...my aspx page is here...
<%@ Page Language="C#" AutoEventWireup="true" %><%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls" TagPrefix="asp" %><!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" style="height:100%;"><head runat="server"> <title>SampleSilverlightApplication</title> <script type="text/javascript"> function Hide() { document.getElementById("divv").style.display= 'none'; } function Show() { document.getElementById("divv").style.display = "block"; } </script></head><body style="height:100%;margin:0;"> <form id="form1" runat="server" style="height:100%;"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div id="divv" style="height:300px;" > <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/SampleSilverlightApplication.xap" MinimumVersion="2.0.31005.0" Width="39%" Height="100%" /> </div> </form> <p> <input id="Button1" type="button" value="Hide" onclick="Hide()" /> <input id="Button2" type="button" onclick="Show()" value="Show" /></p></body></html>
I'm tired of searching the solution for this problem...Kindly help....
ken tucker
All-Star
16192 points
2,467 Posts
06-27-2009 6:37 AM |
You need to give the silverlight control a definate height not a % for it to work in firefox
<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/SampleSilverlightApplication.xap" MinimumVersion="2.0.31005.0" Width="39%" Height="300" />
06-27-2009 6:41 AM |
I changed to pixels, then also sl doesn't renders in the div tag
06-27-2009 6:43 AM |
I changed to pixels, then also silverlight control doesn't renders in the div tag...
06-27-2009 8:18 AM |
Sorry I missed you are using a % for the width also. You need to set the width in pixels also
06-27-2009 8:34 AM |
ken tucker: Sorry I missed you are using a % for the width also. You need to set the width in pixels also
Thanks ken for your reply...i have already tried out this for width too..then also its not working for me in firefox v3...
<div id="divv" style="height:300px;" > <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/SampleSilverlightApplication.xap" MinimumVersion="2.0.31005.0" Width="400px" Height="300px" /> </div>
Ken Tucker
06-27-2009 5:52 PM |
Do other silverlight apps work on your instance of firefox?
06-29-2009 2:42 AM |
No i tried in some other apps also it doesn't works for me....can you please run that aspx page and see......i tried out all possibilities but no solution yet....
Jonathan...
24626 points
2,418 Posts
07-03-2009 4:06 AM |
Hi Karthikn87,
This is a known issue now. Currently, the workaround is to set its height to '0px' when we want to hide it. For example,
<form id="form1" runat="server" style="height:100%;"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <input type="button" value="show" onclick="show()"/> <input type="button" value="hide" onclick="hide()"/> <div style="height:100%;" id="divContainer"> <asp:Silverlight ID="Silverlight1" runat="server" Source="~/ClientBin/JavascriptTest.xap" MinimumVersion="3.0.40307.0" Width="100%" Height="100%" /> </div> <script type="text/javascript" language="javascript"> function hide() { $get("divContainer").style.height = '0px'; } function show() { $get("divContainer").style.height = '100%'; } </script> </form>
Best regards,
Jonathan