window.showModalDialog does not refresh

Posted on 2003-03-28
Medium Priority
Last Modified: 2007-12-19

I am developing a front end for an SQL Server database using ASP. The interface is menu driven. My problem is that I use window.showModalDialog to display the results of a query. However, AFTER viewing the results, if I add more records to the database using the ASP front-end, and query again, I don't see that record being added.

However that record is being added to the database. If I quit the browser and reload the page, the results are shown correctly. If I add any records, before doing a query, those records are shown.

I am certain that this is a problem of window.showModalDialog acting up! Any ideas on how I can force refresh of the modal dialog everytime it loads?

Many Thanx!
Question by:yusufkhatri
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

Accepted Solution

johnczimm earned 1000 total points
ID: 8225333
You need to put your page in a hostframe.
Create a new page called dialogboxhostframe.htm and put the following code after the </head> section:
     <SCRIPT language="JavaScript" type="text/javascript">
               window.onerror = handleError;
               function handleError() {
                    return true;

               linkURL = ""
               if (location.search) {
                    callingURL = location.search
                    if (callingURL.indexOf('?') != -1) {
                         linkURL = callingURL.substring(callingURL.indexOf('?')+1, callingURL.length)
               document.writeln('<FRAMESET ROWS="0,*" frameSpacing="0" frameBorder="0">')
               document.writeln('<FRAME SRC="" noResize scrolling="no">')
               document.writeln('<FRAME SRC="' + linkURL + '" NAME="ReportData" scrolling="no">')

From the page you want to show your modalDialog create a function like this:
function ShowModalDialog(name,height,width) {
     var retval="";
     var props = "dialogHeight: " + height + "px; dialogWidth: " + width + "px; edge: Raised;"
     props += "center: Yes; help: No; resizable: No; status: No; scroll: No;"
     retval=window.showModalDialog('dialogboxhostframe.htm?' + name,window,props);
     if(retval!="" && retval!=null) {

To call it use:

Author Comment

ID: 8230542
Hi johnczimm,

Thanx a lot for your answer. I used a variation of ur suggestion and it worked. Instead of using frames, I used iframe instead, since my target browser shall always be IE.

However, I still dont understand why that happens? Do you have an explanation for that as well?

Many Thanx!

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to implement server side field validation and display customized error messages to the client.
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

762 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