Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Charlie Miller   on Jul 02 In Asp.net Category.

  
Question Answered By: Katrina Edwards   on Jul 02

I am interested in this ... I like ActiveX controls ... but looking at your code  you would seem to know more than I.

Will try this out myself, but first thoughts are ::

<SCRIPT language="vb" for="pbi" >
'********** next line  is the one that I am hoping to get working******
Call pbi.rooms.Add("Room1")
</SCRIPT>

should work ... as all that has happened at this point is that the ActiveX should have been downloaded client  side by the server. What i can suggest is that that snippet is above the actual embedded object  and jscript runs as loads so it doesn't know about your ActiveX at that point. Move script  referencing the ActiveX to below where the object exists. I think ?

else add a button  to do it on a click  ( that way the page  has time to coplete downloading)

<SCRIPT language="vb" for="pbi" >
function AddRoom(){
Call pbi.rooms.Add("Room1")
}
</SCRIPT>
<button on click =AddRoom()>..............


Regards referencing the object from code behind.
Well, any asp.NET object you put in a web  page needs to have a ref to it in the code behind.
If you plonk a panel on aspx  page from the toolbox, then a line like
protected System.Web.UI.WebControls.Panel Panel1; will appear in the code behind and you code to it using Panel1.Property

Well, is your ActiveX a client side control  or a server side  control ??? If you embedd it in a web page then it would appear to be a client side control.
But it could, if registered on the server, also be a serverside control.
If it was registered on the server then you would need to create a reference  to it to use it with code behind ... and you couldn't simply use something like System.Web.UI.WebControls.Panel Panel1; because it is not part of the .NET libraries. You would need to look at Interop and how to import a COM component  ... off the top of my head I don't know - but I do know that it can be done and is not very hard to do.
Once this is done then accessing the ActiveX server object's methods should be ok.

Note :: There are 2 different scenarios mentioned above.
A client side ActiveX control will simply be downloaded to the client and all of its functionality is wrapped into it. If it needs to access the server then it must do it itself.It must be registered on the client machine (their downfall!).
A server side ActiveX is one that is registered on the server, it can be imported into a .NET assemby and its methods accessed, those methods may access resources on the server (db, etc) and may output html as whole or part of the aspx page.
In this sense they appear to be similar to a .NET server control, indeed they are. BUT .... an ActiveX server control of this nature would not be added  to the aspx designer  code as you have shown below .... it would appear purely in the code. The reason is that the object tags you see that are added to the designer when you plonk a server control on an aspx page are whooly part of .NET .... do NOT think of them as actual code but think o fthem as HTML that is outputted by code ... what appears there when it arrives on the client is NOT an embedded control it is plain and simple html.
Ther is another type of embedded control .... similar to a java applet ... a windows control that is embedded in a web page. It has a tag like
<object id="wincontrol" classid="exeone.exe#exeone.mycontrol1" width=448 height=305> and runs CLIENT SIDE after being downloaded.
and again, this is NOT a server web control, just as the below is NOT a server web control, and a java applet is NOT a server web control.

<OBJECT id="pbi" style="Z-INDEX: 101; LEFT:
95px; WIDTH: 521px; POSITION: absolute; TOP: 59px; HEIGHT: 175px"
classid="clsid:CB93D4CA-F746-11D2-9118-00A0241E587F" name="pbi">
</OBJECT>
immediately implies that the ActiveX object is running client side.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on issues with using activex component on web form Or get search suggestion and latest updates.


Tagged: