I am working Dot Net Nuke Project where I need to show a Garph. I have created different 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 " 'Silverlight' is undefined"
Can anyone tell me where I am going wrong??
Do I have to add the Silver Light Project in my Dot Net Nuke Project??
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 <script> 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.
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.
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.
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.
shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.
varshamane
Member
74 Points
27 Posts
SilverLight and Dot Net Nuke
Jan 23, 2008 02:13 PM | LINK
Hi All,
I am working Dot Net Nuke Project where I need to show a Garph. I have created different 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 " 'Silverlight' is undefined"
Can anyone tell me where I am going wrong??
Do I have to add the Silver Light Project in my Dot Net Nuke Project??
Please help me... Thanks for the help....
SilverLight and Dot Net Nuke Error
Bill Reiss
Contributor
4973 Points
947 Posts
Re: SilverLight and Dot Net Nuke
Jan 23, 2008 02:18 PM | LINK
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 <script> 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.
Bill Reiss, Coauthor of Hello! Silverlight
My blog
varshamane
Member
74 Points
27 Posts
Re: SilverLight and Dot Net Nuke
Jan 23, 2008 02:33 PM | LINK
Thanks for the reply. Here is what I am doing. I am having a user control called ValuationChart.ascx where I am added this script tag
<
script type="text/javascript"> function createSilverlight(){
Silverlight.createObjectEx({
source: "Page.xaml",parentElement: document.getElementById(
"SilverlightControlHost"), id: "SilverlightControl",properties: {
width: "100%",height:
"100%", version: "1.1",enableHtmlAccess:
"true"},
events: {}
});
document.body.onload = function() { var silverlightControl = document.getElementById('SilverlightControl'); if (silverlightControl)silverlightControl.focus();
}
}
</script> and in html table Ihave added this code<
div id="SilverlightControlHost"> <script type="text/javascript"> alert("Varsha");createSilverlight(
'Page.xaml'); </script> </div>and Page.xaml in there in the same folder where my user control is there.
Also I have added
<
script type="text/javascript" src="../../js/Silverlight.js"></script>but I get the error at Silverlight.createObjectEx. I dont know why. Do I need to add the SilverLight Class Libaray and the SilverLight Project???
Thanks for the reply....
Bill Reiss
Contributor
4973 Points
947 Posts
Re: SilverLight and Dot Net Nuke
Jan 23, 2008 02:36 PM | LINK
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.
Bill Reiss, Coauthor of Hello! Silverlight
My blog
varshamane
Member
74 Points
27 Posts
Re: SilverLight and Dot Net Nuke
Jan 23, 2008 02:43 PM | LINK
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 ???
Bill Reiss
Contributor
4973 Points
947 Posts
Re: SilverLight and Dot Net Nuke
Jan 23, 2008 02:46 PM | LINK
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.
Bill Reiss, Coauthor of Hello! Silverlight
My blog
mchlSync
Star
14968 Points
2799 Posts
Re: SilverLight and Dot Net Nuke
Jan 24, 2008 09:51 AM | LINK
You can check-out this example if you want to know how to use Silverlight in DotNetNuke project.
OR
As vershamane suggested, you should try to use the absolute path... (eg: http://yourwebsite/js/silverlight.js )
Regards,
Michael Sync
Silverlight MVP
Blog : http://michaelsync.net
Yi-Lun Luo -...
All-Star
25149 Points
2759 Posts
Microsoft
Re: SilverLight and Dot Net Nuke
Jan 25, 2008 07:06 AM | LINK
Hello, from your error message, I think you missed this:
if (!window.Silverlight)
window.Silverlight = {};
You’ll also need this so your event handlers will work:
Silverlight.createDelegate = function(instance, method) {
return function() {
return method.apply(instance, arguments);
}
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.
varshamane
Member
74 Points
27 Posts
Re: Re: SilverLight and Dot Net Nuke
Jan 25, 2008 09:43 AM | LINK
Link is not opening....