Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

showModalDialog web form opens again after closing the ModalDialog window

Posted on 2008-06-22
2
Medium Priority
?
848 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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

916 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