Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Asp.net

Posted on 2015-02-13
9
Medium Priority
?
115 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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 2000 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

Certified OpenStack Administrator Course

We just refreshed our COA course based on the Newton exam.  With 14 labs, this course goes over the different OpenStack services that are part of the certification: Dashboard, Identity Service, Image Service, Networking, Compute, Object Storage, Block Storage, and Orchestration.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…

721 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