Solved

Asp.net

Posted on 2015-02-13
9
114 Views
Last Modified: 2015-03-02
Hi guys ,

I'm working on asp.net mvc application and i would like to do the following:

I want to disable the window browser close(X) while I am opening my ModalDialog box.


thanks ,
0
Comment
Question by:Moti Mashiah
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 40609319
You can't disable the close button on a browser window for security reasons, such as malicious pop-ups on web sites trying to get you to click a button and install a virus or trojan without closing the window.
0
 
LVL 1

Author Comment

by:Moti Mashiah
ID: 40609728
I missed understand the solution.

I will explain the situation again:

when users work on the main page they click on button which popup for them another webpage. what i would like to do is in a while user work on the popup page they can't close the main page.

Thanks ,
0
 
LVL 1

Author Comment

by:Moti Mashiah
ID: 40609731
I have another comment which will explain it much better :)

when I open child page I want to prevent from users to close the parent page. The users will be able to close the parent page just when they close the child page first.


Thanks ,
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 29

Expert Comment

by:Paul Jackson
ID: 40609739
How are you opening the child page using Javascript or JQuery? Please post the code you are using to open the modal dialog?
0
 
LVL 1

Author Comment

by:Moti Mashiah
ID: 40609751
this is the javascript:

 function picCatalog() {
            var url = "@System.Configuration.ConfigurationManager.AppSettings["webUrl"]";
            url = url + "Altstorepo/Index";
            window.open(url, '_blank', 'resizable=yes');
        }

Open in new window

0
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 40609895
Use the window.showModalDialog() javascript function instead:

window.showModalDialog(url,'_blank','resizable=yes');

Open in new window


However to future-proof your code you should really investigate using jquery dialogs which provide an option to make dialogs modal.
0
 
LVL 1

Author Comment

by:Moti Mashiah
ID: 40611282
This method "showModalDialog" is not working on chrome. when I click on the button nothing popup.
0
 
LVL 10

Accepted Solution

by:
Jini Jose earned 500 total points
ID: 40630213
you can use a simple javascript method.

<script language="JavaScript">
  var needToConfirm = true;

  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
    if (needToConfirm)
      return message to display in dialog box;
  }
</script>

Open in new window


for more details go the below link
http://stackoverflow.com/questions/1565304/jquery-prevent-window-closing
0
 
LVL 1

Author Closing Comment

by:Moti Mashiah
ID: 40640176
help
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question