Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: How to call methods of an ActiveX control


Message #1 by "cindy zhou" <czhou@w...> on Wed, 30 Oct 2002 16:14:26
I have embedded an ActiveX control in my ASP page. I want to call the 
methods of that control. I called the "run" method of the object "rpt"

<object classid="blahblah" id="rpt">
<%rpt.run%>

There is error message shows that the "rpt" is undefined variable. So 
anything wrong here?

cindy
Message #2 by Teng-Fong SEAK <tfseak@f...> on Wed, 30 Oct 2002 17:29:13 +0100
You're talking about declaring object in global.asa, right?  If yes, 
look at
this :

http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/iisre
f/html
/psdk/asp/asps0d6b.asp

You could see that there's no such attribute as classid for <object> in
server-side.  There's an attribute called progid.

However, if you're talking about client-side coding, you should put <% 
and
%>.  You seem to have a very big confusion.  Look at your book first to 
see
what you want to do exactly.

> -----Message d'origine-----
> De : cindy zhou [mailto:czhou@w...]
> Envoy=C3=A9 : mercredi 30 octobre 2002 17:14
> =C3=80 : ASP components
> Objet : [asp_components] How to call methods of an ActiveX control
>
>
> I have embedded an ActiveX control in my ASP page. I want to call the 

> methods of that control. I called the "run" method of the object 
"rpt"
>
> <object classid=3D"blahblah" id=3D"rpt">
> <%rpt.run%>
>
> There is error message shows that the "rpt" is undefined variable. So 

> anything wrong here?
>
> cindy
> 
> tfseak@f...
> %%email.unsub%%
>
>
Message #3 by "cindy zhou" <czhou@w...> on Wed, 30 Oct 2002 17:15:13
Thanks for your reply.

First of all, I am not talking about declaring object in global.asa.

What I am trying to do now is put an visual ActiveX control on my ASP 
page, so that is why there are those <object> tags with classid and id 
attributes. 

For this ActiveX Control (say id="rpt"), I want to call its methods. But 
seems I cannot access the control by its id in my <% %> block. My question 
is how I can call its methods in <% %> block? What should be used as the 
object name (apparently "rpt" is not allowed)?

thanks,
Cindy
Message #4 by Teng-Fong SEAK <tfseak@f...> on Wed, 30 Oct 2002 19:12:44 +0100
Hmm, I see you've really got confusion.

The activeX control that you want to use will be displayed on users'
browsers, right?  If yes, you're dealing with client-side issue.  In 
this
case, the ActiveX control is on your _Web_ page, not just ASP.  In 
other
words, it's just HTML page.

On the other hand, <% and %> are symbols for
<script language=3Dany_language runat=3Dserver> and </script>
In other words, what's between <% and %> are run in the web server.  
See the
problem?

You want to instantiate an object in client side but you then want to
execute it in server side !!

I haven't played much with ActiveX and <object>, but I guess the syntax 
is
something like this :

<object classid=3D"blahblah" id=3D"rpt">

<script language=3Djavascript>
rpt.run()
</script>

HTH

> -----Message d'origine-----
> De : cindy zhou [mailto:czhou@w...]
> Envoy=C3=A9 : mercredi 30 octobre 2002 18:15
> =C3=80 : ASP components
> Objet : [asp_components] RE: How to call methods of an ActiveX 
control
>
>
> Thanks for your reply.
>
> First of all, I am not talking about declaring object in global.asa.
>
> What I am trying to do now is put an visual ActiveX control on my ASP 

> page, so that is why there are those <object> tags with
> classid and id
> attributes.
>
> For this ActiveX Control (say id=3D"rpt"), I want to call its
> methods. But
> seems I cannot access the control by its id in my <% %>
> block. My question
> is how I can call its methods in <% %> block? What should be
> used as the
> object name (apparently "rpt" is not allowed)?
>
> thanks,
> Cindy
>
Message #5 by "cindy zhou" <czhou@w...> on Thu, 31 Oct 2002 15:58:40
Yeah, you are absolutely right. I was really confused. Thanks very much 
for straighting things out for me.

So if I put an visual ActiveX Control on my web page, the only way to call 
its methods is within the <script> </script> tags which is on the client-
side. On the other hand, if I include an ActiveX DLL on my ASP page, it is 
a server-side component and I can invoke its mehtods inside <% %>. I guess 
this time I am right.

Thanks again for the explanation.

Cindy


> Hmm, I see you've really got confusion.

The activeX control that you want to use will be displayed on users'
browsers, right?  If yes, you're dealing with client-side issue.  In 
this
case, the ActiveX control is on your _Web_ page, not just ASP.  In 
other
words, it's just HTML page.

On the other hand, <% and %> are symbols for
<script language=3Dany_language runat=3Dserver> and </script>
In other words, what's between <% and %> are run in the web server.  
See the
problem?

You want to instantiate an object in client side but you then want to
execute it in server side !!

I haven't played much with ActiveX and <object>, but I guess the syntax 
is
something like this :

<object classid=3D"blahblah" id="rpt">

<script language=javascript>
rpt.run()
</script>

HTH
Message #6 by Teng-Fong SEAK <tfseak@f...> on Thu, 31 Oct 2002 18:13:41 +0100
> -----Message d'origine-----
> De : cindy zhou [mailto:czhou@w...]
> Envoy=C3=A9 : jeudi 31 octobre 2002 16:59
> =C3=80 : ASP components
> Objet : [asp_components] RE: How to call methods of an
> ActiveX contro l
>
>
> Yeah, you are absolutely right. I was really confused. Thanks
> very much
> for straighting things out for me.
>
> So if I put an visual ActiveX Control on my web page, the
> only way to call
> its methods is within the <script> </script> tags which is on
> the client-
> side.

	Actually, it's methods can be called anywhere when possible and not
only within <script> </script>, eg for event handlers, but of course, 
that
would really depend on its adequacy.

> On the other hand, if I include an ActiveX DLL on my
> ASP page, it is
> a server-side component and I can invoke its mehtods inside
> <% %>. I guess
> this time I am right.

	Yes, that's it.
>
> Thanks again for the explanation.
>
> Cindy
>

  Return to Index