I am using WP7 WebBrowser control . On this page I have a hyperlink.This link are came from web service. I want to handle the click event of that hyperlink in my application's code behind (i.e. in C#).And i want display another web browser controll on this hyperlink click event
Is there are a way for the WebBrowser control to handle click events?
If i understand you, you want to intercept the onClick event in your first WB control (call this WB1), and open that page up (when the hyperlink is clicked) in another WB control (call this WB2)?
There are several ways you can do this, is this link set to open up in a new window? If so, you can intercept the NewWindow2 event is WB1 and run the following code in the NewWindow2 event of WB1...
Set pDisp = WB2.object
(it may be ppDisp instead of pDisp, but it will show up when your event is auto generated, choose whichever object name shows up in your arguments list).
Otherwise, you can intercept this request during BeforeNavigate2 event of the WB1 event, check the URL property if it is the link you're interested in, and if so, cancel the current request and reissue a new one as below... (in the WB1 BN2 event)...
Cancel = True ' This cancels the request
WB2.Navigate2 URL, , "YourWB2sDocumentNameOrTargetFrameNameGoesHere"
Second line of code just reissues the request.
Of course, the YourWB2sDocumentNameOrTargetFrameNameGoesHere is the TargetFrameName (or the frame or document name of the top level document, or any iframe, in your WB2 control/window). This can usually be found in the BODY tags name= property, but you don't even need to do this if all you want is to load it as the top level document in WB2... if you just want to load it as the parent top level document in WB2, just do this...
Cancel = True
WB2.Navigate2 URL
By referencing WB2 it will just send the same URL request to WB2 window after cancelling WB1 request.
Let me know if you need more help and let me know how you get along.