alexthecodepoet
asked on
help accessing objects
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.HtmlControl s.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#m ynamespace .cwdActive XClass"
VIEWASTEXT>
</OBJECT>
<%
string s = "Original Text";
mainform.objActiveX.strMod ifiableStr ing = s;
Response.Write(s);
%>
<script language="javascript">
var a = mainform.objActiveX.modify word();
document.write(a);
</script>
</form>
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.HtmlControl
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#m
VIEWASTEXT>
</OBJECT>
<%
string s = "Original Text";
mainform.objActiveX.strMod
Response.Write(s);
%>
<script language="javascript">
var a = mainform.objActiveX.modify
document.write(a);
</script>
</form>
try adding runat="server" to the object declaration
ASKER
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
plus, that doesn't work
ASKER
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.strMod ifiableStr ing = document.getElementById("h iddenSessi onID").val ue;
var a = mainform.objActiveX.modify word();
document.write(a);
</script>
so basically, i use the hidden input field as an inbetween layer for javascript and C# to talk..
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.strMod
var a = mainform.objActiveX.modify
document.write(a);
</script>
so basically, i use the hidden input field as an inbetween layer for javascript and C# to talk..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.