How to access com properties in asp.net

G

Guest

Hi Guys,

In my ASP.net application, I want to comunicate with DLL installed on client
machine and for that, I developed an ActiveX control in vb and incorporated
in my aspx page using Object tag.
this ActiveX control c
I am trying to access its properties by clicking on the button. I am doing
this in jscript function and calling the function on OnClick event of button,
but I am not getting any result nor I am getting any error

The object tag I have defined is

<OBJECT id="ucHWKey" style="Z-INDEX: 111; LEFT: 672px; POSITION: absolute;
TOP: 88px" classid="clsid:781D9F61-F7FA-49F6-BABC-6989022730BA"
name="ctrHWKey" VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="8308">
<PARAM NAME="_ExtentY" VALUE="688">
<PARAM NAME="BackColor" VALUE="-2147483633">
<PARAM NAME="ForeColor" VALUE="-2147483640">
<PARAM NAME="Enabled" VALUE="-1">
<PARAM NAME="BackStyle" VALUE="1">
<PARAM NAME="BorderStyle" VALUE="0">
</OBJECT>

whereas the script function I wrote is,

function CheckValidKey()
{
if (document.getElementById)
{
var oHK = document.getElementById("ucHWKey");
window.alert ("Checking Property");
if (oHK.IsValidKey)
window.alert ("Valid Key");
else
window.alert ("Invalid Key");
}
}

When I click on the button I get "Checking Property" alert, but not getting
any of the later alerts.

Am I doing anything wrong?
Please guide me how do I access properties of vb ActiveX control in my aspx
page

Thanks

Jeetendra
 
P

pjondevelopment

Greetings...

It's just a case of misplaced semi-colon. Try to change the code to...


function CheckValidKey()
{
if (document.getElementById)
{
var oHK = document.getElementById("ucHWKey");
window.alert ("Checking Property");
if (oHK.IsValidKey)
{
window.alert ("Valid Key"); // <-- this was the misplaced
semi-colon
}
else
{
window.alert ("Invalid Key");
}
}
}

I think it will work now.

Just for the sake of completeness, the correct if...else syntax is:

if (<test>)
<statement> | <codeblock>
[else
<statement>; | <codeblock>]

<test> ::= BOOLEAN expression evaluated as TRUE of FALSE
<codeblock> ::= { <statement> [; <statement>...] }
<statement> ::= any valid command

I hope it helps.

Regards,

PJ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top