Javascript Model Window Wont Fire Page_Load

I have a page that fires a popup window and in that popup window I have some logic that I need to perform in the Page_Load.

Works great the first time as the popup window gets created, the problem is each subsequent call does not fire the Page_Load event. This is because the form is still in memory and has not disposed.

So the secret to making the form go away on close code like this;

[code:c#]

        // a script to be run in client-side
        string scriptStr = “<script>window.close();</script>”;

        // send the script to output stream
        ClientScript.RegisterClientScriptBlock(typeof(string), “closing”, scriptStr);

[/code]

On the ASPX page put this as the very first line (as in line #1);

[code:html]<% Response.Expires = -1;%>[/code]

Super!

Enjoy!

Leave a Reply