Javascript 重定向父级-关闭弹出窗口-ASP
我需要从点击弹出窗口中的提交按钮重定向父页面的帮助 应发生以下情况:Javascript 重定向父级-关闭弹出窗口-ASP,javascript,asp.net,Javascript,Asp.net,我需要从点击弹出窗口中的提交按钮重定向父页面的帮助 应发生以下情况: 用户点击提交按钮,弹出窗口中的参数将在url中传递 父页面将重定向到详细信息页面 弹出窗口关闭 发生了什么: 用户点击提交按钮,弹出窗口中的参数将在url中传递 提交的参赛作品 父级不重定向 弹出窗口将被重定向 代码 ReturnValue.url = "TransDetailMain.aspx?AcctDate=" +AcctDate+ "&AcctCategoryCode=" +AcctCategoryCode+
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);
问题:
我假设您正在使用javascript,所以我在这里写作 在这里检查我的答案
String x=“window.opener.location.href=”**完成测试后新页面的新url**;self.close();”;
ScriptManager.RegisterClientScriptBlock(this.Page,this.Page.GetType(),“script”,x,false);
它说明self.close()当前url将被关闭,新url将被打开
因此,您的新代码将如下所示
那现在怎么办
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);
String x=“window.opener.location.href=”**TransDetailMain.aspx?AcctDate=“+AcctDate+”&AcctCategoryCode=“+AcctCategoryCode+”&DeptProfitCtr=“+DeptProfitCtr+”&RefDocNum=“+RefDocNum+”&COMMAND=Edit&ref&RefDocNum\u PAGE\u KEY=MtMonthlyCatalystMain.aspx**;self.close()”;
ScriptManager.RegisterClientScriptBlock(this.Page,this.Page.GetType(),“script”,x,false);
将此项放在弹出窗口中,然后单击“提交”
所以将会发生的是,父对象将被重定向,当前窗口将被关闭
注意:此代码未经测试
我希望这将有助于您……:)非常感谢。它在弹出窗口中打开“详细信息”页面,但父窗口仍然保持打开状态,即使它通过self.close()传递;
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);