ASP.NET Page_Unload to prevent user from leaving the page
Possible Duplicate:
Best way to detect when a user leaves a web page
I am trying to give the user the option to stay on the current page when they try to navigate away from it (assuming they haven't saved the changes in their progress). I'm not sure how to approach this as I tried and failed to execute JavaScript.
I hope there is a way inside the Page_Unload function in ASP.NET C # code.
any help would be much appreciated.
source to share
See this post "The best way to detect when a user leaves a page . " This should help you. You MUST do this on the client side, although as if they were leaving, the server never knows.
source to share
This is a required parameter: the lifecycle of the Asp.NET page . Always keep in mind that only after the server side has finished running, the page is sent to the client.
source to share