Solved

showModalDialog web form opens again after closing the ModalDialog window

Posted on 2008-06-22
2
836 Views
Last Modified: 2010-05-18
I'm opening a ModalDialog .aspx page (SaveNewDialogWindow.aspx) and setting the returnValue property to store info entered into the controls on that page.   After the ModalDialog window closes, a new window re-opens displaying the same SaveNewDialogWindow.aspx page, but just a new window with none of the features in the original ModalDialog .aspx page.  Can anyone tell me what I'm doing wrong?

Javascript function from the calling page that opens the ModalDialog .aspx page:

    function SaveTemplate()  
    {            
            var returnValue = window.showModalDialog("SaveNewDialogWindow.aspx","","dialogHeight:100px;dialogWidth:280px;status:no");
            return false;        
    }


Javascript function from SaveNewDialogWindow.aspx that sets the returnValue of the window:
function ReturnValue(button)
{
    window.returnValue = "Cancel";
    if (button == "OK")
    {    
        window.returnValue = "OK|" + document.getElementById("chkDefault").checked + "|" + document.getElementById("txtTemplateName").value;                 
      }
      else
      {
          window.returnValue = button;
      }
      window.close()
}


0
Comment
Question by:trebems
2 Comments
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 125 total points
ID: 21841871
The problem is submutting the form in a modal dialog.
ASP.NET doesn't handle it correctly.

In order to fix this, put this in the head of your html
<BASE TARGET="self">
0
 

Author Comment

by:trebems
ID: 21847237
That did it!  Thanks!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

707 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

19 Experts available now in Live!

Get 1:1 Help Now