|
So, I'm getting my feet wet with hosting controls in IE, and as a simple test I'm just trying to get access to a simple function to change the text of a label in the control from a standard html button hooked to a javascript function. I created a basic control library in VS.Net 2005, added my label, and added a public function to the class defintion as follows:
public void changeLabel() { lblStatus.Text= "Changed"; }
I've compiled the control and embedded it into the following html file:
<html> <head> <script language="javascript"> function doit() { change1.changeLabel(); } </script> </head> <body> <p>Simple Example<br /> <br /> <input type="button" onclick="doit();" value="Push Me"/> </body> <object id="change1" classid="http:change.dll#change.change" height="500" width="500"> </object> </html>
When I view the page, the control loads as expected, but when I press the button, I get an error that says the object doesn't support the method. I've seen some other examples online (although very few) which seem to indicate that adding script access to the controls should be as easy as defining the public method and calling it. Obviously, I'm doing something wrong, because this should be a fairly simple exercise. Any help or suggestions would be greatly appreciated.
Thanks in Advance,
-Erik Taylor
|