help accessing objects

Posted on 2006-07-23
Last Modified: 2006-11-18

I have the following code (see below).

Why is it that if i try to access objActiveX using inline C# code,
(the       <%  string s = "Original Text";)

, it doesn't work.  i get this:
 'System.Web.UI.HtmlControls.HtmlForm' does not contain a definition for 'objActiveX'

but the 2nd example (using Javascript), does?

I need a way to access it using C# instead of Javascript.  Does anyone know a solution?



<form runat="server" id="mainform">      
            <OBJECT id="objActiveX" height="1" width="1"
                string s = "Original Text";
                mainform.objActiveX.strModifiableString = s;

                  <script language="javascript">
              var a = mainform.objActiveX.modifyword();
Question by:alexthecodepoet
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
  • 2
LVL 39

Expert Comment

ID: 17165828
try adding runat="server" to the object declaration

Author Comment

ID: 17169581
that wouldn't make sense, as the object is supposed to be run client side, since its an activeX component.

plus, that doesn't work

Author Comment

ID: 17172724
i got it to work by doing this:

    void Page_Load(object s, EventArgs e)
        hiddenSessionID.Value = Session.SessionID.ToString();

                       <input id="hiddenSessionID" value="hello world" runat="server"  />
             <script type="text/javascript" language="javascript">
                        mainform.objActiveX.strModifiableString = document.getElementById("hiddenSessionID").value;
              var a = mainform.objActiveX.modifyword();

so basically, i use the hidden input field as an inbetween layer for javascript and C# to talk..

Accepted Solution

GhostMod earned 0 total points
ID: 17206077
Closed, 500 points refunded.

Community Support Moderator

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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 …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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