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 Sergey Alexandrovich Kryukov 383
1 OriginalGriff 304
2 George Jonsson 258
3 Animesh Datta 130
4 Shemeemsha RA 128
0 OriginalGriff 6,099
1 Sergey Alexandrovich Kryukov 5,411
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web02 | 2.8.140916.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