Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi,
 
I want to disable the window browser close(X) while I am opening my ModalDialog box, which is small in size and contains buttons for OK and Close.
 
When the user clicks the 'Close' button the child page should be closed. It should not get closed while they are clicking browser close button.
 
<script language="javascript" type="text/javascript">
 
        function Onclick()
        {
 

        RetVal = window.showModalDialog("CabinMappingChild.aspx","CabinMapping","dialogHeight: 190px; dialogWidth: 550px; titlebar: no; toolbar: no; statusbar:no");
        }
 </script>
 
I am using the above code but still I could not get it to work.
 

Can anyone please help me?
Posted 1-Sep-10 2:55am
Edited 1-Sep-10 3:28am
v2
Comments
Sandeep Mewara at 1-Sep-10 16:47pm
   
Follow up question by OP:
No... i don;t want full screen option.....
Ok... is it possible to write function definition for (like in javascript) while user clicking browser close(x)???
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You are not allowed to disable the close button in the browser for security reasons.
 
However... You can open the window in fullscreen size which means the browser automatically will hide the titlebar and the minimize, maximize, and close buttons!
 
To open a webform in fullscreen see below:
 
window.open('WebForm2.aspx', '', 'Fullscreen=yes');
 

Hope that helps!
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Its not working on my button click event...
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

YOU CAN disable parent window.. See this link.
 
http://forums.asp.net/t/1212594.aspx/1[^]
  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 505
1 Maciej Los 309
2 BillWoodruff 174
3 /\jmot 160
4 Suraj Sahoo | Coding Passion 160
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 12 Sep 2012
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