| |

VerySource

 Forgot password?
 Register
Search
View: 716|Reply: 8

Is there a way for ModalDialog to close automatically and refresh the parent page?

[Copy link]

4

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-1-20 23:00:01
| Show all posts |Read mode
I use
Response.Write ("<script>; opener.location.href = window.opener.location.href; window.close (); </ script>"); ModalDialog cannot be closed automatically and the parent page cannot be refreshed.
If you don't use ModalDialog, you can use other pop-up windows.
Please give pointers.
Reply

Use magic Report

0

Threads

17

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-1-30 19:00:02
| Show all posts
Write this code to the foreground, refresh the parent page and close yourself.

window.dialogArguments.location.reload ();
window.close ();
Reply

Use magic Report

4

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-2-2 05:54:01
| Show all posts
Is it written in HTML?
Reply

Use magic Report

0

Threads

17

Posts

14.00

Credits

Newbie

Rank: 1

Credits
14.00

 China

Post time: 2020-2-4 11:45:02
| Show all posts
Correct!
Reply

Use magic Report

0

Threads

73

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-2-6 09:15:02
| Show all posts
a.htm:
<input type = button value = abc onclick = "showModalDialog ('b.htm', window, '');">

b.htm:
<input type = button value = abc onclick = "window.dialogArguments.location.reload (); window.close ();">
Reply

Use magic Report

4

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 Spain

 Author| Post time: 2020-2-6 19:45:02
| Show all posts
But I wrote it like this.
There are two pages,
1.user_list.aspx.cs
2.user_info.aspx.cs
In the first page, I added an increase button. The code is as follows:
private void btn_Add_Click (object sender, System.EventArgs e)
{
Page.RegisterStartupScript ("ShowWindow", "<script> javascript: window.showModalDialog ('user_info.aspx', '_ blank', 'scroll: 0; status: 0; help: 0; dialogWidth: 290px; dialogHeight: 165px') </ script> ");
}
On the second page, I wrote:
Response.Write ("<script language = 'javascript'> window.dialogArguments.location.reload (true); alert ('Successfully added employees!'); Window.close (); </ script>");
But when you click the add button on the first page, the second page pops up. When you click the "Save" button on the second page, the first page cannot be refreshed, and the second page will not close. The "Cancel" button on the two pages cannot be closed. The closing code is as follows:
private void ImageButton2_Click (object sender, System.Web.UI.ImageClickEventArgs e)
{
Response.Write ("<script language: javascript> javascript: window.close (); </ script>");

}
Please frighten and give thanks, kneeling thank you!
I would like to ask a small question, how to verify the control pop-up dialog dialog box, thank you.
Reply

Use magic Report

0

Threads

73

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-2-8 16:45:01
| Show all posts
Page.RegisterStartupScript ("ShowWindow", "<script> javascript: window.showModalDialog ('user_info.aspx', window, 'scroll: 0; status: 0; help: 0; dialogWidth: 290px; dialogHeight: 165px') </ script> ");
Reply

Use magic Report

4

Threads

10

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

 Author| Post time: 2020-2-9 13:15:01
| Show all posts
Just tried thezhouji700code, and prompted:

If you do not resend the data, the page will not refresh. Please click "Retry" to play the new page again.
After I tried again, it still didn't refresh
Reply

Use magic Report

0

Threads

73

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-3-16 20:15:01
| Show all posts
Then put:
window.dialogArguments.location.reload ()
Into:
window.dialogArguments.location.href = window.dialogArguments.location.href;
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list