Hello Philippe,
In addition to bruce's points, I'd suggest the KB article
http://support.microsoft.com/kb/317392. It demonstrates how to host an
ActiveX control in ASP.NET (for your first question), and points out that
ActiveX control is a pure client-side control, the server-side code cannot
access this control (for your second question). Server-side code can access
only server controls, which are the controls that are listed on the Web
Form tab in the toolbox. But do we have any workarounds to get/set ActiveX
control properties from the server-side code? Yes, we have.
A. To set an ActiveX control property from the serve side:
As bruce mentioned, we can render a script block to set the variables. For
example:
Response.Write("<script>myControl1.myProperty='aaa ';</script>");
where "myControl1" is the client-side ID of the ActiveX control.
B. To get an ActiveX control property from the server side:
Suppose that you want to get the ActiveX control's property in a asp.net
button Click postback, we can register a client-side onclick event for the
button:
<asp:Button runat=server ID='btn' OnClientClick='clientSideClickEvent'
OnClick='serverSideClickEvent'¡* />
In the clientSideClickEvent javascript function, we get the ActiveX
control's property and place the value in a hidden field (e.g.
asp:HiddenField). After then, we can get the property value from the
asp:HiddenField control in our server side OnClick call back.
Please let me know if you have any other concerns, or need anything else.
Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.