How to know when the window of my application is closed?
How to know when the window of my application is closed?
Hi,
I would like to run a function when I close the window of my application. For example, imagine that what I would like to do is to open a new window when I close the window of my application. (This is just a example of a function to test my problem)
The code would look like this:
Response.Write("");
I tried many solutions, but I haven't found yet anyone that works.
If I put this code in the PAGE_UNLOAD event, this would fire everytime that the page refresh, and this means that a new window is opened everytime I click on a button, select in a dropdownlist and so....
If I put the code in the PAGE_DISPOSED event, or in the SESSION_ENDS or APPLICATION_ENDS of the Global.asax.cs file, the code is not executed so the new window is not opened when closing my application.
After this, I tried to put that between the tags or of the HTML code, for example like this:
With "ONUNLOAD" I got the same result as in "Page_Unload", and with the rest of the events that I tried ("ONDRAG", "ONDRAG", ...) nothing is executed, so the new window is not opened. I also tried "ONCLOSE", but this event is not recognized, and the window is not opened neither.
The code is OK, because the code is properly executed when using the Page_unLoad event or the HTML code with onunload, the problem is to find WHEN or HOW does it recognise that the window is closed.
Thanks,
goraperas
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
yasser_8227158 pointsPosted Mar 14, 2005, 2:25 PM EST