# Reload \<asp:Silverlight\> control from Javascript?

**URL:** <https://forum.kirupa.com/t/reload-asp-silverlight-control-from-javascript/289084>\
**Category:** Uncategorized\
**Created:** [May 26, 2009, 8:40am UTC](https://forum.kirupa.com/t/reload-asp-silverlight-control-from-javascript/289084 "2009-05-26T08:40:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![winseelan](https://avatars.discourse-cdn.com/v4/letter/w/85f322/32.png) [@winseelan](https://forum.kirupa.com/u/winseelan)\
**Post date:** [May 26, 2009, 8:40am UTC](https://forum.kirupa.com/t/reload-asp-silverlight-control-from-javascript/289084/1 "2009-05-26T08:40:46Z")

</div>

I want to pass the value to initparameters dynamically from Javascript file, so i have written the function like this

\<asp:Silverlight ID=“sl1” runat=“server” Width=“770” Height=“290”  
Source="~/ClientBin/MyProj.xap"\>  
\</asp:Silverlight\>  
function A()  
{  
CallSLImageComp(1, 1, 0, ‘slCheck’);  
var silverlightApp = document.getElementById(“trSL2”);  
var parent = silverlightApp.parentNode;  
parent.removeChild(silverlightApp);  
parent.appendChild(silverlightApp);  
}  
function CallSLImage(data1, data2, data3,ControlName) {  
var strParam = “data1=” + data1 + “,data2=” + data2 + “,data3=” + data3;  
Sys.UI.Silverlight.Control.createObject(ControlName + ‘\_parent’, ‘\<object type=“application/x-silverlight” id=’+ControlName + ’ style=“height:290;width:770;”\> \<param name=“InitParams” value="’ + strParam + ‘"\>\</param\> \<a href="[[COLOR=#0000ff]http://go2.microsoft.com/fwlink/?LinkID=114576&v=1.0[/COLOR]"\> \<img src="[URL=“http://go2.microsoft.com/fwlink/?LinkID=108181”][COLOR=#0000ff]http://go2.microsoft.com/fwlink/?LinkID=108181[/COLOR]](http://go2.microsoft.com/fwlink/?LinkID=114576&v=1.0)" alt=“Get Microsoft Silverlight” style=“border-width:0;” /\>\</a\>\</object\>’);  
}  
at the first time, its working fine, but if i call the same function again then Silverlight control is not initializing, so that Silverlight control not have any output,  
Experts please tell me what is the wrong the code?  
[![](http://go2.microsoft.com/fwlink/?LinkID=108181)](http://go2.microsoft.com/fwlink/?LinkID=114576&v=1.0)'); } at the first time, its working fine, but if i call the same function again then Silverlight control is not initializing, so that Silverlight control not have any output, Experts please tell me what is the wrong the code?
