简体   繁体   中英

Javascript Redirection after the alert message

I have one asp.net page , it consists of some controls along with a close button. If the user clicks on the close button, it will open ModaldialogBox with one text box for entering closing reason. Once the user enters the reason and clicking on the save button, the modal popup shows the alert message and close the modal popup. The existing code for this is shown below.

this.Page.ClientScript.RegisterStartupScript(GetType(), "close", "alert('" + Message + "');var xWin=window.dialogArguments;xWin.location.replace(xWin.location);window.close();", true);

My requirement is that, once the user click on the submit button, I have to navigate to the dashboard page after closing the modal popup window.

I had tried window.location.href after the window.close(), It will open another window and displyed the page. But it should navigate from the existing asp parent page. Please help me for resolving this issue.

Thanks in advance

使用以下代码重定向父窗口

window.opener.parent.location.href = 'dashboardurl';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM