Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
How can I handle internet explorer buttons in asp.net e.g back, forward
and I want to that when any one click the close button then it display message (ok, cancel)
Posted 16-Feb-13 20:01pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use onbeforeunload event - It is called before the unload event when you click the close button.
 
An article on similar lines: Save Changes on Close of Browser or When Exiting the Page[^]
  Permalink  
Comments
riteshsingh_jsr at 17-Feb-13 2:23am
   
Not worked Sandeep....
Sandeep Mewara at 17-Feb-13 2:38am
   
Don't just copy-paste and then say 'not working'. Seriously it discourages to answer such questions.
 
That is the event to use. Tie it with a JS method such that when it is raised, ask if they want to close or not.
Similar discussion if you need to know more around it: http://stackoverflow.com/questions/4427714/confirm-dialog-when-i-close-the-browser
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 377
1 Nirav Prabtani 284
2 Richard Deeming 190
3 _Amy 170
4 Mehdi Gholam 140
0 Nirav Prabtani 265
1 OriginalGriff 177
2 _Amy 170
3 Mehdi Gholam 105
4 Maciej Los 90


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 17 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100