Solved

How to use ocx in asp.net page

Posted on 2009-04-07
6
568 Views
Last Modified: 2012-05-06
I am trying to include the ocx in the webpage

please guide me
0
Comment
Question by:PBCHANDRAN
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 20 total points
ID: 24084826
OCX is a client side object, you can embed it into webpage using object tag, like this:

<script language="javascript">
function CJSObject() {
      this.mAttrName = new Array();
      this.mAttrValue = new Array();
      this.mAttrNameNoValue = new Array();
      this.mParamName = new Array();
      this.mParamValue = new Array();
      this.SetAttr = function(sAttrName, sAttrValue) {
            this.mAttrName[this.mAttrName.length] = sAttrName;
            this.mAttrValue[this.mAttrValue.length] = sAttrValue;
      }
      this.SetAttrNoValue = function(sAttrName) {
            this.mAttrNameNoValue[this.mAttrNameNoValue.length] = sAttrName;
      }
      this.SetParam = function(sParamName, sParamValue) {
            this.mParamName[this.mParamName.length] = sParamName;
            this.mParamValue[this.mParamValue.length] = sParamValue;
      }
      this.GetObjectHTML = function() {
            var sRet = "";
            
            sRet += "<";
            sRet += "ob";
            sRet += "je";
            sRet += "ct";
            for (var i = 0; i < this.mAttrName.length; i++) {
                  sRet += " " + this.mAttrName[i] + "=\"" + this.mAttrValue[i] + "\"";
            }
            for (var i = 0; i < this.mAttrNameNoValue.length; i++) {
                  sRet += " " + this.mAttrNameNoValue[i];
            }
            sRet += "\">\r\n";
            for (var i = 0; i < this.mParamName.length; i++) {
                  sRet += "\t<";
                  sRet += "pa";
                  sRet += "ram";
                  sRet += " name=\"" + this.mParamName[i];
                  sRet += "\" value=\"" + this.mParamValue[i];
                  sRet += "\">\r\n";
            }
            sRet += "</";
            sRet += "obj";
            sRet += "e";
            sRet += "ct";
            sRet += ">\r\n";
            
            return sRet;                        
      }
}
</script>

then:

<script type="text/javascript">
      var gobjSLV = new CJSObject();

      gobjSLV.SetAttr("id", "yourObjID");
      gobjSLV.SetAttr("name", "objname");
      gobjSLV.SetAttr("width", "1px");
      gobjSLV.SetAttr("height", "1px");
      gobjSLV.SetAttr("classid", "clsid:E59B6131-5F73-B202-856F-146921A178BB");

      gobjSLV.SetAttr("type", "application/x-oleobject");
      gobjSLV.SetAttrNoValue("whatever");

      var sHtml = gobjSLV.GetObjectHTML();
      document.write(sHtml);
</script>

or follow link:

http://www.fpoint.com/support/whitep/ActiveX/ax1999.aspx#content
0
 

Author Comment

by:PBCHANDRAN
ID: 24085286
I want to access the function in asp.net by using ocx

and ocx will be writtern in vc++
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 24085298
ocx is not a server side object, you only can interact with it by javascript.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:PBCHANDRAN
ID: 24094647
I am using this Object tag in the Html page
I want to draw the lines in that object for that i have writtern ocx
The thing is  i have writtern draw function in ocx but it doesnt display in the  html page.
How to do it.
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 24095551
>>The thing is  i have writtern draw function in ocx but it doesnt display in the  html page.

Seems that you got some problem on your object, you can try post another question so that other experts can help you debug your object scripts.
0
 

Author Comment

by:PBCHANDRAN
ID: 24105001
yes the object is working fine
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
age from date of birth 4 63
Insert Button on a table 16 55
Extracting nodes  using classical ASP 3 41
Read text on Table 7 49
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question