472,354 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

RE: Handling ActiveX in ASP.net

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.

Jun 27 '08 #1
1 1848
Hi Jianlang,
"Jialiang Ge [MSFT]" <ji****@online.microsoft.coma écrit dans le message
de news:Dr**************@TK2MSFTNGHUB02.phx.gbl...
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.
This post is eally helpful to me.
Thank you very much

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Patrick | last post by:
I understand that with IIS5.1 on Windows XP Professional SP1, I can 1) Either set under IIS Manager-> Any specific Virtual Directory-> Configuration->Options->ASP Script timeout for all pages...
3
by: klimontovich | last post by:
Hello! I'm trying to handle events raising by Microsoft ActiveX Spreadsheet control. I use following code to include this control into page: <object...
2
by: S.Kartikeyan | last post by:
Hello group, I have the follwing problem with microsoft web browser activex control. I have a fileopendialog control. I open different files in the IEActivex control based on the filename in the...
2
by: Bill | last post by:
I have a VB6 ActiveX EXE app that generates events that I would like to handle in a C# application. The events in the VB app are defined like: Public Event SometingHappened(what As String) ...
1
by: Felipe Garcia | last post by:
i have some old asp pages that uses activex controls. At the moment, my company are converting all of these old asp pages to asp.net. So my question is, there is a way to handle activex events in...
3
by: J055 | last post by:
Hi How do I tell the user he has tried to upload a file which is too big... 1. when the httpRuntime.maxRequestLength has been exceeded and 2. when the uploaded file is under then...
0
by: Itchy Ferret | last post by:
Yo I have exactly same problem as the below. Does anyone know a solution, pls? Thanks, Itchy. -------------------------------------------
1
by: SeemaPal | last post by:
Hi friends I have a problem in my project with ActiveX control. i am using older version of spread control. it thrown an exception "InvalidActivexStateException accured in...
6
by: hufaunder | last post by:
I have an ActiveX component that I want to use in a library that I am writing. As a first test I used the ActiveX component in a windows form application. Adding the component created: Ax.dll...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.