Skip to main content

Microsoft Silverlight

Unanswered Question Silverlight Control not rendering in div tag using firefoxRSS Feed

(0)

karthikn87
karthikn87

Member

Member

0 points

5 Posts

Silverlight Control not rendering in div tag using firefox

 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
ken tucker

All-Star

All-Star

15738 points

2,390 Posts

Re: Silverlight Control not rendering in div tag using firefox

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" />

karthikn87
karthikn87

Member

Member

0 points

5 Posts

Re: Re: Silverlight Control not rendering in div tag using firefox

  I changed to pixels, then also sl doesn't renders in the div tag

karthikn87
karthikn87

Member

Member

0 points

5 Posts

Re: Silverlight Control not rendering in div tag using firefox

 I changed to pixels, then also silverlight control doesn't renders in the div tag...

ken tucker
ken tucker

All-Star

All-Star

15738 points

2,390 Posts

Re: Silverlight Control not rendering in div tag using firefox

 Sorry I missed you are using a % for the width also.  You need to set the width in pixels also

karthikn87
karthikn87

Member

Member

0 points

5 Posts

Re: Silverlight Control not rendering in div tag using firefox

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
Ken Tucker

All-Star

All-Star

15738 points

2,390 Posts

Re: Silverlight Control not rendering in div tag using firefox

Do other silverlight apps work on your instance of firefox?

karthikn87
karthikn87

Member

Member

0 points

5 Posts

Re: Silverlight Control not rendering in div tag using firefox

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 Shen – MSFT
Jonathan...

All-Star

All-Star

23562 points

2,304 Posts

Microsoft

Re: Silverlight Control not rendering in div tag using firefox

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

Jonathan Shen
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities