RE: Handling ActiveX in ASP.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jialiang Ge [MSFT]

    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>myCont rol1.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=' clientSideClick Event'
    OnClick='server SideClickEvent' ¡­ />
    In the clientSideClick Event 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 (jialge@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:
    msdnmg@microsof t.com.

    =============== =============== =============== =====
    Get notification to my posts through email? Please refer to
    Gain technical skills through documentation and training, earn certifications and connect with the community

    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.

  • PhilTheGap

    #2
    Re: Handling ActiveX in ASP.net

    Hi Jianlang,
    "Jialiang Ge [MSFT]" <jialge@online. microsoft.coma écrit dans le message
    de news:DrD3JRxvIH A.3620@TK2MSFTN GHUB02.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>myCont rol1.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=' clientSideClick Event'
    OnClick='server SideClickEvent' ¡­ />
    In the clientSideClick Event 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

    Comment

    Working...