I have to web hosts. One is an apache server (localhost) and the other is the VS 2008 debugging server (the one we get when running a web project).I currently have a php webpage on the apache server, which contains the silverlight object hosted on the VS
2008 server, I also have a accompanying JavaScript file which allows me to access the HTML elements on the php web page. I have an object('bar') declared as a ScriptableObject in the Silverlight 2 application.
When I click on the php webpage, the Javascript will find the closest element to where I clicked and will give the X Y coordinates of the element. However it seems that I can't access the Scriptable object. I have made the enableHtmlAccess property to true
in the Silverlight object. Please help. Any help is much appreciated. :)
Thank you.
Nilu
My code is below:
Silverlight Code:
[ScriptableType] public partial class Page : UserControl { void Page_Loaded(object sender, RoutedEventArgs e) { XYPos myObject = new XYPos(); // contains ScriptableMembers X and Y HtmlPage.RegisterScriptableObject("myObject", myObject); } . . .
I don't think you will be able to access any managd object direcly like that.But you can create some property and methods which can do same thing.
Your ultimate aim is to get x and y coordinate of object x so i think that thing you can achieve this way. For that you have to Decorate Sciptable member attribute to your method or property..
Thanks for that :) After some searching I was able to find that it isn't actually possible to grab the ScriptableObject. Which means that what you said the best option. Cheers HarshBardhan!
I realised that you can't actually get the content or the createObject() when in a 3rd party website, so even having scriptable members didn't help me (either property or method). So I had to rely on serializing the results I wanted into a string and send
them back to Silverlight.
If you guys know a better way please let me know. :)
hii... im a nubie in silverlight programming. any body ever try an datagrid on aspx is exported to silverlight datagrid? because im trying to connect MySQL (using NET Connector from MySQL)to silverlight datagrid using ADO, but i dont know why it cannot possible.
@tanlith : can you tell me how to run Silverlight on apache? thanks thank you before. i hope you can help my problem. thx.
I'm not sure about the datagrid question as I haven't actually used datagrids with Silverlight or ASPX. :( In terms of hosting Silverlight applications on apache
this link might help you with that. If you want it display Silverlight on a apache hosted website - you need to enable some MIME types; which the article mentions. Hope this helps.
tanlinth
Member
32 Points
40 Posts
Accessing Script Objects from a third party website
Aug 29, 2008 02:06 PM | LINK
Hi,
I have to web hosts. One is an apache server (localhost) and the other is the VS 2008 debugging server (the one we get when running a web project).I currently have a php webpage on the apache server, which contains the silverlight object hosted on the VS 2008 server, I also have a accompanying JavaScript file which allows me to access the HTML elements on the php web page. I have an object('bar') declared as a ScriptableObject in the Silverlight 2 application.
When I click on the php webpage, the Javascript will find the closest element to where I clicked and will give the X Y coordinates of the element. However it seems that I can't access the Scriptable object. I have made the enableHtmlAccess property to true in the Silverlight object. Please help. Any help is much appreciated. :)
Thank you.
Nilu
My code is below:
Silverlight Code:
JavaScript Code:
function getPos(x, y) {
// get the silverlight object
var silverlightObj = document.getElementById('silverlightObject');
silverlightObj.content.myObject.X = getClosestElementX();
silverlightObj.content.myObject.Y = getClosestElementY();
}
third party webpage web page access scriptable object
HarshBardhan
Star
10118 Points
1749 Posts
Re: Accessing Script Objects from a third party website
Aug 29, 2008 02:34 PM | LINK
Hi ,
I don't think you will be able to access any managd object direcly like that.But you can create some property and methods which can do same thing.
Your ultimate aim is to get x and y coordinate of object x so i think that thing you can achieve this way. For that you have to Decorate Sciptable member attribute to your method or property..
[ScriptableMember()]
private void Mname(double x, double y)
{
//code goes here }
Harsh Bardhan
tanlinth
Member
32 Points
40 Posts
Re: Re: Accessing Script Objects from a third party website
Aug 29, 2008 02:51 PM | LINK
Thanks for that :) After some searching I was able to find that it isn't actually possible to grab the ScriptableObject. Which means that what you said the best option. Cheers HarshBardhan!
Nilu
HarshBardhan
Star
10118 Points
1749 Posts
Re: Re: Accessing Script Objects from a third party website
Aug 29, 2008 02:54 PM | LINK
Thanks man...You Can expose Properties and method..
I think you Posted this twice.
So you can close other one also if it answers...
Harsh Bardhan
tanlinth
Member
32 Points
40 Posts
Re: Re: Re: Accessing Script Objects from a third party website
Aug 30, 2008 11:19 AM | LINK
I realised that you can't actually get the content or the createObject() when in a 3rd party website, so even having scriptable members didn't help me (either property or method). So I had to rely on serializing the results I wanted into a string and send them back to Silverlight.
If you guys know a better way please let me know. :)
desmodromics
Member
10 Points
12 Posts
Re: Re: Re: Re: Accessing Script Objects from a third party website
Apr 24, 2009 06:23 PM | LINK
tanlinth
Member
32 Points
40 Posts
Hosting Silverlight from Apache
Apr 27, 2009 01:46 AM | LINK
I'm not sure about the datagrid question as I haven't actually used datagrids with Silverlight or ASPX. :( In terms of hosting Silverlight applications on apache this link might help you with that. If you want it display Silverlight on a apache hosted website - you need to enable some MIME types; which the article mentions. Hope this helps.
Cheers,
Nilu
desmodromics
Member
10 Points
12 Posts
Re: Hosting Silverlight from Apache
Apr 27, 2009 06:17 AM | LINK