beyerss
beyerss

Reputation: 1352

capturing javascript events in c#

I'm running google earth in a web browser that is embedded in a c# app. I have captured an event through javascript that fires when the user right clicks on the globe. How can I bubble an event to go from the javascript to c# so that it can be handled there?

Thanks

Upvotes: 2

Views: 1640

Answers (1)

Sachin Gaur
Sachin Gaur

Reputation:

To raise an event from Javascript, you need to follow these steps:

1) Create a hidden asp:button in your aspx page.
2) write the following JS code in aspx file:
     var btnHidden = document.getElementById(HiddenButtonClientId);
       if (btnHidden) { btnHidden.click(); }

Now, your button click event will be fired and you can write desirable code there.

Upvotes: 1

Related Questions