Solved

Asp.net

Posted on 2015-02-13
9
109 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
  • 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now