The AX is running on the client, and you c# code is running on your server. How could you get a ref from server to client? Or did I misunderstand you?
On Tue, Apr 14, 2009 at 4:30 AM, Codii <[email protected]> wrote: > > Hi, > > I have an ASP.NET page , with a simple script that creates an instance > of the Google Earth plugin (ActiveX control). > > It works fine. I need to know when the control is initialised and > ready, so I use a page method call to do this. > > In the page method call I am trying to pass to the C# code the > IGEPlugin instance (COM interface), however, the page method does call > into C#, but i cannot get the instantiated GE plugin reference. > > Do you know how I can get a handle to this control? > > I have included the aspx page for your attention. PageMethods.GEReady > (ge,SuccessCB,failureCB); gets called ok, but the ge object (of type > IGEPlugin) is empty when I debug it in C#. > > Any help would be greatly appreciated as I am really stuck. I could > use the window.external JS method, but i don't know how to sink this > in a web form. Also I have not found any examples on this :-( > > Thanks for reading. > > Noel > > > Default.aspx: > > <%@ Page Language="C#" AutoEventWireup="true" > CodeBehind="Default.aspx.cs" > Inherits="AJAXEnabledWebApplication_Go._Default" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// > www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8"/ >> > <title>Google Earth API Sample</title> > <script src="http://www.google.com/jsapi? > key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q"></ > script> > > <script type="text/javascript"> > var ge; > google.load("earth", "1"); > > function init() { > var content = document.getElementById('content'); > content.innerHTML = '<input type="button" value="Move the > Camera!" onclick="moveCamera()" />'; > > google.earth.createInstance('content', initCB, failureCB); > } > > function initCB(instance) { > ge = instance; > ge.getWindow().setVisibility(true); > > > // add a navigation control > ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO); > > // add some layers > ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true); > ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true); > > document.getElementById('installed-plugin-version').innerHTML = > ge.getPluginVersion().toString(); > > PageMethods.GEReady(ge,SuccessCB,failureCB); > > } > > function failureCB(errorCode) { > alert("Failed!!"); > } > > function SuccessCB(errorCode) { > alert("Success!!"); > } > > function moveCamera() { > var lookAt = ge.getView().copyAsLookAt > (ge.ALTITUDE_RELATIVE_TO_GROUND); > lookAt.setLatitude(lookAt.getLatitude() + 2); > lookAt.setLongitude(lookAt.getLongitude() + 20); > ge.getView().setAbstractView(lookAt); > } > > google.setOnLoadCallback(init); > > </script> > </head> > <body style="font-family: Arial;font-size:13px;border: 0 none;"> > <div id="content" style="width: 380px; height: 380px;" > runat="server" visible="true"> > Loading... > </div> > <form id="form1" runat="server"> > <asp:ScriptManager ID="ScriptManager1" runat="server" > EnablePageMethods="True" EnablePartialRendering="False"> > </asp:ScriptManager> > </form> > <br/><br/> > Installed Plugin Version: <div id="installed-plugin-version" > style="display:inline;"></div> > </body> > </html> > > > > > -- Best Regards, David Shen
