views:

18

answers:

1

Hello.

I did not find any post or tutorial related to the topic mentioned above.

Basically, I am have a page viewed in webbrowser control.

the page is a form . if the form is submitted successfully I get transfer to success page(using HttpContext.Current.Server.Transfer) and if I get transfered to that page , I would like some javascript , Silverlight interaction to let the Silverlight application know that the form is submitted successfully.

thanks

Jamal.

P.S

One way I thought was that, I would check the source of the webbrowser control from the SL app. but source property of webbrowser is not getting updated , if the page gets browsed to some other page from within the page using some hyper link or so.

A: 

put following javascript on that page, this will notfiy your WebBrowser control in Silverlight, that the form is submitted successfully, I would suggest using Response.Redirect rathar than Server.Transfer.

    <script type="text/javascript" language="javascript" >
        window.external.notify('Your text to pass to Silverlight');
    </script>

Register the ScriptNotify event of WebBrowser control in Silverlight..

Xaml:

    <WebBrowser x:Name="myWebBrowser" ScriptNotify="myWebBrowser_ScriptNotify" ></WebBrowser>

Code Behind:

    private void myWebBrowser_ScriptNotify(object sender, NotifyEventArgs e)
    {
        string response = e.Value; // e.Value will be "Your text to pass to Silverlight"
    }
Zain Shaikh