Home>

There is iFrame (A ') in the main screen (A),
When the button placed on screen A 'is pressed,
Screen B is activated modally.
There is iFrame (B ') in screen B,
Press the button located on screen B '
I want to update screen A 'and close screen B.


Developed with C # .NET.
I would like to realize the above operation
I'm having trouble.

Applicable source code

[Screen A's .net source (where the modal screen starts)]

string strScript = "window.showModalDialog ('./ B.aspx', window, 'dialogWidth = 800px;dialogHeight = 160px;dialogLeft = 300px;dialogTop = 400px;');";
            Page.ClientScript.RegisterStartupScript (this.GetType (), "OpenBWindow", strScript, true);


[Screen B's .net source (where the screen A 'reload process is executed and closed)]

// string strScript = "window.dialogArguments.location.reload (true);";// (1)
 // string strScript = "window.dialogArguments.document.getElementById ('FrmLvwRecipe'). contentDocument.location.reload (true);";// (2)
 // string strScript = "window.parent.opener.document.getElementById ('FrmLvwRecipe'). contentDocument.location.reload (true);";// (3)
 // string strScript = "dialogArguments.test ();";// (4)
 Page.ClientScript.RegisterStartupScript (this.GetType (), "WindowClose", strScript, true);

[screen A's javascript source (reload processing)]

function test () {
alert ("!!!!!");
window.location.reload (true);
 }


The .net source on the B screen side is the above
None of (1) to (3) works.
(4) creates a function called test with javascript on screen A '
I updated the screen and displayed an alert in test
Screen A 'was not reloaded, only alerts were displayed
It seems that the test function is called. . .

Problem environment

OS: Windows10
IE: 11.864
MicrpspftVisualStudioCommunity2019: 16.1.4
Microsoft.NETFrameworrk: 4.8.03761

  • Answer # 1

    My comment on the question,

      

    Please describe specifically what you mean by "modal child screen". (ShowModalDialog? ModalPopupExtender? JQuery UI Dialog? Bootstrap Modals? Others?)

    There is no answer to

    ..., but here is an example that uses ModalPopupExtender of ASP.NET Ajax Control Toolkit.

    Hide ModalPopup from another page
    http://surferonwww.info/BlogEngine/post/2013/01/27/hide-modalpopup-by-clicking-a-button-placed-in-another-page.aspx