Programming with JavaScripthttp://forums.silverlight.net//16.aspx/1?Programming+with+JavaScriptDiscussions about programming Silverlight with JavaScriptMon, 01 Jan 0001 00:00:00 -05001627599http://forums.silverlight.net//p/8839/27599.aspx/1?SilverLight+and+Dot+Net+NukeSilverLight and Dot Net Nuke <p>Hi All,</p> <p>&nbsp;I am working Dot Net Nuke Project&nbsp;where I need to show a Garph. I have created different&nbsp;Silver Light Project where Graph is created now I want to merge/add this in my Dot Net Nuke Project. I just look the dll of Silver Light Project and added in bin folder of dot Net Nuke Project and added Page.xaml in the same Project but I am getting runtime javascript error &quot; 'Silverlight' is undefined&quot;&nbsp;</p> <p>Can anyone tell me where I am going wrong??</p> <p>&nbsp;Do I have to add the Silver Light Project in my Dot Net Nuke Project??</p> <p>&nbsp;Please help me... Thanks for the help....</p> 2008-01-23T13:13:07-05:0027601http://forums.silverlight.net//p/8839/27601.aspx/1?Re+SilverLight+and+Dot+Net+NukeRe: SilverLight and Dot Net Nuke <p>Sounds like the Silverlight.js file is not loading properly. Confirm the path and that you can access it from there. You may want to use a tool such as Fiddler to make sure it's getting loaded successfully. It could also be that the Silverlight.js file isn't being loaded by the time the page needs it, this can be resolved by putting the &lt;script&gt; tag for loading Silverlight.js into the same element that the script that is giving you the error is in. If none of this works, I've seen cases where a syntax error somewhere else in the Javascript can cause this.</p> 2008-01-23T13:18:28-05:0027604http://forums.silverlight.net//p/8839/27604.aspx/1?Re+SilverLight+and+Dot+Net+NukeRe: SilverLight and Dot Net Nuke <p>Thanks for the reply. Here is what I am doing. I am having a user control called&nbsp;&nbsp;&nbsp;<font color="#0000ff" size="2">ValuationChart.ascx</font> where I am added this script tag</p> <font color="#0000ff" size="2"> <p>&lt;</font><font color="#a31515" size="2">script</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;text/javascript&quot;&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">function</font><font size="2"> createSilverlight()</font></p> <p><font size="2">{</p> </font><font size="2"> <p>Silverlight.createObjectEx({</p> source: </font><font color="#a31515" size="2">&quot;Page.xaml&quot;</font><font size="2">,</font><font size="2"> <p>parentElement: document.getElementById(</font><font color="#a31515" size="2">&quot;SilverlightControlHost&quot;</font><font size="2">),</p> id: </font><font color="#a31515" size="2">&quot;SilverlightControl&quot;</font><font size="2">,</font><font size="2"> <p>properties: {</p> width: </font><font color="#a31515" size="2">&quot;100%&quot;</font><font size="2">,</font><font size="2"> <p>height: </font><font color="#a31515" size="2">&quot;100%&quot;</font><font size="2">,</p> version: </font><font color="#a31515" size="2">&quot;1.1&quot;</font><font size="2">,</font><font size="2"> <p>enableHtmlAccess: </font><font color="#a31515" size="2">&quot;true&quot;</p> </font><font size="2"> <p>},</p> <p>events: {}</p> <p>});</p> <p>&nbsp;</p> document.body.onload = </font><font color="#0000ff" size="2">function</font><font size="2">() {</font><font size="2"> <p></font><font color="#0000ff" size="2">var</font><font size="2"> silverlightControl = document.getElementById(</font><font color="#a31515" size="2">'SilverlightControl'</font><font size="2">);</p> </font><font color="#0000ff" size="2">if</font><font size="2"> (silverlightControl)</font><font size="2"> <p>silverlightControl.focus(); </p> <p>}</p> <p>}</p> </font><font color="#0000ff" size="2">&lt;/</font><font color="#a31515" size="2">script</font><font color="#0000ff" size="2">&gt;</font><font color="#0000ff" size="2"> <p></font><font color="#0000ff">and in html table Ihave added this code</font></p> <font color="#0000ff" size="2"> <p>&lt;</font><font color="#a31515" size="2">div</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;SilverlightControlHost&quot;&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#a31515" size="2">script</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;text/javascript&quot;&gt;</p> </font><font size="2">alert(</font><font color="#a31515" size="2">&quot;Varsha&quot;</font><font size="2">);</font><font size="2"> <p>createSilverlight(</font><font color="#a31515" size="2">'Page.xaml'</font><font size="2">);</p> <p></font><font color="#0000ff" size="2">&lt;/</font><font color="#a31515" size="2">script</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;/</font><font color="#a31515" size="2">div</font><font color="#0000ff" size="2">&gt;</font></p> <p><font color="#0000ff" size="2">and Page.xaml in there in the same folder where my user control is there.</font></p> <p><font color="#0000ff" size="2">Also I have added</font></p> <font color="#0000ff" size="2"><font color="#0000ff" size="2"> <p>&lt;</font><font color="#a31515" size="2">script</font><font color="#000000" size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;text/javascript&quot;</font><font color="#000000" size="2"> </font><font color="#ff0000" size="2">src</font><font color="#0000ff" size="2">=&quot;../../js/Silverlight.js&quot;&gt;&lt;/</font><font color="#a31515" size="2">script</font><font color="#0000ff" size="2">&gt;</font></p> <p><font color="#0000ff" size="2">but I get the error at <font size="2">Silverlight.createObjectEx. I dont know why. Do I need to add the SilverLight Class Libaray and the SilverLight Project???</font></font></p> <p><font color="#0000ff" size="2"><font size="2">&nbsp;Thanks for the reply....</font></font><font color="#0000ff" size="2"><font size="2"></p> </font></font></font> 2008-01-23T13:33:03-05:0027606http://forums.silverlight.net//p/8839/27606.aspx/1?Re+SilverLight+and+Dot+Net+NukeRe: SilverLight and Dot Net Nuke <p>Maybe it's having trouble with the relative path? The relative path should be from the page's location, not the user control's. Try an absolute path to the silverlight.js and see if that helps.</p> 2008-01-23T13:36:50-05:0027607http://forums.silverlight.net//p/8839/27607.aspx/1?Re+SilverLight+and+Dot+Net+NukeRe: SilverLight and Dot Net Nuke <p>Thanks again, but i need to show that graph on that user control itself. I have check with the path also and its correct. Is there any other way ???</p> 2008-01-23T13:43:02-05:0027608http://forums.silverlight.net//p/8839/27608.aspx/1?Re+SilverLight+and+Dot+Net+NukeRe: SilverLight and Dot Net Nuke <p>I'm not saying you can't use a user control, just that the relative path is relative to the page's location in the file structure, not the user control's, so you may be getting the relative path wrong. Keep it as a user control, but specify an absolute path to the Silverlight.js and see if that helps.</p> 2008-01-23T13:46:31-05:0027772http://forums.silverlight.net//p/8839/27772.aspx/1?Re+SilverLight+and+Dot+Net+NukeRe: SilverLight and Dot Net Nuke <p>You can check-out <a href="http://dnnsilverlight.adefwebserver.com/Samples/SilverlightToolBar/tabid/64/Default.aspx"> this example</a> if you want to know how to use Silverlight in DotNetNuke project. </p> <p>OR</p> <p>As vershamane suggested, you should try to use the absolute path... (eg: http://yourwebsite/js/silverlight.js )<br> </p> 2008-01-24T08:51:44-05:0027946http://forums.silverlight.net//p/8839/27946.aspx/1?Re+SilverLight+and+Dot+Net+NukeRe: SilverLight and Dot Net Nuke <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font face="Calibri" size="3">Hello, from your error message, I think you missed this:</font></span></p> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font face="Calibri" size="3">if (!window.Silverlight) </font></span></p> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font size="3"><font face="Calibri"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>window.Silverlight = {};</font></font></span></p> <span lang="EN-US"><font face="Calibri" size="3">&nbsp;</font></span> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font face="Calibri" size="3">You’ll also need this so your event handlers will work:</font></span></p> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font face="Calibri" size="3">Silverlight.createDelegate = function(instance, method) {</font></span></p> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font size="3"><font face="Calibri"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return function() {</font></font></span></p> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font size="3"><font face="Calibri"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>return method.apply(instance, arguments);</font></font></span></p> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font size="3"><font face="Calibri"><span style="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</font></font></span></p> <span lang="EN-US"><font face="Calibri" size="3">&nbsp;</font></span> <p class="MsoNormal" style="margin:0cm 0cm 0pt"><span lang="EN-US"><font face="Calibri" size="3">Anyway, when you create a Silverlight project, you’ll get a Default_html.js. All scripts in that file should be copied to your production page.</font></span></p> <p>&nbsp;</p> 2008-01-25T06:06:34-05:0027959http://forums.silverlight.net//p/8839/27959.aspx/1?Re+Re+SilverLight+and+Dot+Net+NukeRe: Re: SilverLight and Dot Net Nuke <p>Link is not opening....</p> 2008-01-25T08:43:48-05:00