Solved

help accessing objects

Posted on 2006-07-23
5
227 Views
Last Modified: 2006-11-18
Hello,

I have the following code (see below).

Why is it that if i try to access objActiveX using inline C# asp.net 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?


Thanks,

code######################




<form runat="server" id="mainform">      
            <OBJECT id="objActiveX" height="1" width="1"
                        classid="bin/ActiveX.dll#mynamespace.cwdActiveXClass"
                        VIEWASTEXT>
                  </OBJECT>
                  <%
                string s = "Original Text";
                mainform.objActiveX.strModifiableString = s;
                Response.Write(s);                
                  %>

                  <script language="javascript">
              var a = mainform.objActiveX.modifyword();
              document.write(a);
              </script>
</form>
0
Comment
Question by:alexthecodepoet
  • 2
5 Comments
 
LVL 39

Expert Comment

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

Author Comment

by:alexthecodepoet
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
0
 

Author Comment

by:alexthecodepoet
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();
              document.write(a);
              </script>

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

Accepted Solution

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

GhostMod
Community Support Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now