window.showModalDialog off a sub-page refresh parent page

The solution to this problem, there are many, but some methods will always be a problem, the following mention an ultimate solution for reference

Ideas: LinkButton submit a button on the parent page, let it hide, close subpages time for LinkButton onclick event to refresh the page.

First, add a LinkButton let the parent page text is empty, it can be hidden LinkButton, and then register js this button, LinkButton.Attributes.Add ( "onfocus", "javascript: __ doPostBack ( 'btnFresh', '');" );

Add some JS code

 var sReturn=window.showModalDialog("" + id,'','dialogWidth:420px;dialogHeight:570px,center=yes,status=no,resizable=no,scroll=no,dialogHide=on');;
       if (typeof(sReturn) != "undefined")
       {
       if (sReturn=="1")
       {
       
         document.all["btnFresh"].focus();
      
       }
      }

 

Then look at the JS code subpages price

function reload()
 {
         window.parent.returnValue='1';window.close();
  }

Because it is showModalDialog so keep adding <base target = "_ self" /> 

0
0
(Please make evaluations of the article)
 
    // Open the window mode
var id= $("cbH").value;
    var num=$("numH").value;
    htmUrl=htmUrl+"?id="+id+"&num="+num;
    
    var Width="450";
    var Height="200";
    var arguemnts = new Object();
    arguemnts.window = window;
    if (document.all&&window.print)
    {
        window.showModalDialog(htmUrl,arguemnts,"dialogWidth:" + Width + "px;dialogHeight:" + Height + "px;center:yes;status:no;scroll:yes;help:no;");
        window.location.reload();
    }
    else 
    { 
       window.open(htmUrl,"","width=" + Width + "px,height=" + Height + "px,resizable=1,scrollbars=1"); 
    }
 // Close window mode
  function closedialogwindow()
       {
           window.dialogArguments.window.location = window.dialogArguments.window.location;
           self.close();
 
       }

Reproduced in: https: //www.cnblogs.com/zhangchenliang/archive/2010/07/21/1781926.html

Guess you like

Origin blog.csdn.net/weixin_33705053/article/details/93496030