[英]Redirect Parent - Close Popup - ASP
I need help in redirecting parent page from clicking a submit button in its popup window 我需要帮助来重定向父页面,方法是单击其弹出窗口中的“提交”按钮
Should happen: 应该发生:
What happens: 怎么了:
CODE 码
ReturnValue.url = "TransDetailMain.aspx?AcctDate=" +AcctDate+ "&AcctCategoryCode=" +AcctCategoryCode+ "&DeptProfitCtr=" +DeptProfitCtr+ "&RefDocNum=" + RefDocNum + "&COMMAND=Edit&REFERRING_PAGE_KEY=MtMonthlyCatalystMain.aspx";//?AcctDate="+AcctDate;
//window.returnValue = ReturnValue;
window.location.href = ReturnValue.url;
// window.opener.location.href = ReturnValue.url;
//window.parent.location.href=ReturnValue.url;
// similar behavior as an HTTP redirect
// window.location.replace(ReturnValue.url);
ISSUES: 问题:
I am assuming that you are using javascript so i am writing here 我假设您使用的是JavaScript,所以我在这里写
check my answer here How to close current Browser window and redirect to a previously opened window for the same browser 在这里检查我的答案如何关闭当前浏览器窗口并重定向到同一浏览器先前打开的窗口
String x = "<script type='text/javascript'>window.opener.location.href='**Your new url of new page after completing test**';self.close();</script>";
ScriptManager.RegisterClientScriptBlock(this.Page,this.Page.GetType(), "script", x,false);
It illustates that self.close() current will be closed and new url will be open so your new code will be looks like this 它说明了self.close()当前将被关闭,新的url将被打开,因此您的新代码将如下所示
so now what 那么现在怎么办
String x = "<script type='text/javascript'>window.opener.location.href='**TransDetailMain.aspx?AcctDate=" +AcctDate+ "&AcctCategoryCode=" +AcctCategoryCode+ "&DeptProfitCtr=" +DeptProfitCtr+ "&RefDocNum=" + RefDocNum + "&COMMAND=Edit&REFERRING_PAGE_KEY=MtMonthlyCatalystMain.aspx**';self.close();</script>";
ScriptManager.RegisterClientScriptBlock(this.Page,this.Page.GetType(), "script", x,false);
Put this one in your pop up submit click So what will be happen is parent will be redirected and current window will be closed Note:this code is not tested I hope this will help you regards...:) 将其放在您的弹出提交单击中,这样会发生什么事,父级将被重定向,当前窗口将关闭注意:此代码未经测试,希望对您有所帮助... :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.