Raise event from IE hosted windows user control and catch it in the Web Form that’s hosting the control

Hi.

I have a web app that uses a IE hosted windows user control. I would like that, somehow, lounch an external event from that hosted control that I could catch in my web form’s code behind. If possible, please send me a small sample project (bozesan_mihai82@yahoo.com).

But, of course, I would appreciate any suggestions!

Thanks in advance!




Answer this question

Raise event from IE hosted windows user control and catch it in the Web Form that’s hosting the control

  • lenab

    Thanks...I'll give it a try....I'll let you know tomorrow



  • internettalk

    If this is .NET control - make public property.


  • Hiral Soni

    Ups, that make things a little harder. Your control can expose some kind of ButtonToClick property and HTML can set this property to button. Then your control simply use this button (IHTMLElement interface, Click method).


  • .neo

    Do you know how could I access that button from the client side
    Can you give me a small sample code
    Thanks


  • ramatim

    No, this must be property of your control. To let your control know which button to push.


  • KnutVG

    Hi!

    Launch event from client side to catch in the server side You need to post back web request. I'm not sure this is the best way, but I think it's good to create button on web form (hidden button) and from your control push this button.


  • Roland Jochems

    And how could I expose such property for my control


  • pd42

    1. Your ActiveXLogIn control must expose ButtonToPush property of IHTMLElement type.
    2. In HTML your button have some id, let say buttonOK
    3. Small scripting must be added - when page loaded, it must do something like this (I not able to verify all details right now) onload="ActiveXLogIn.ButtonToPush = buttonOK"
    4. When your ActiveXLogIn need to push button:
    if(ButtonToPush != null)
    ButtonToPush.Click();


  • fihs_johnW

    I can't find any ButtonToPush property in IHTMLElement!

  • Unjedai

    Sorry that I'm pushing you...It's just that I'm a beginner and I don't know too many things about this. Could you provide me a small sample project please
    Something like this: my windows user control is declared as an object into the html code:
    <OBJECT id="ActiveXLogIn" classid="AuthX.dll#AuthX.XLogIn" VIEWASTEXT>
    </OBJECT>
    So, my windows user control is AuthX.dll. And from that dll I need to access the button from the web form that's hosting it.
    If you can do that, that would really solve my problem ( bozesan_mihai82@yahoo.com )
    Thank a million!


  • BrianD65

    But still, your sample is about accessing a button from client script. What I really need is how to access the web forms' button from the windows user control that the web form is hosting.Would you know how to do that
    Thanks for the help!


  • P. Weyrosta

    Then go to the link I provided - it's exactly about accessing HTML button from WebBrowser control.


  • Doug K

    Oh...I'm using Visual Studio 7, and I don't have WebBrowser class here.


  • Denis Voyer

    If you need to access button from script - add id attribute to it and in script you can access by this id. Something like: <input id="MyButton"...> and in script MyButton.Method().

    BTW, I already made sample on this some time ago, this was for client side application (that host web browser) but you may find it useful. Check here http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=248929&SiteID=1.



  • Raise event from IE hosted windows user control and catch it in the Web Form that’s hosting the control