1

我需要通过单击弹出窗口中的提交按钮来重定向父页面的帮助

应该发生:

  1. 用户点击提交按钮,弹出窗口中的参数将在 url 中传递
  2. 父页面将重定向到详细信息页面
  3. 弹出窗口关闭

怎么了:

  1. 用户点击提交按钮,弹出窗口中的参数将在 url 中传递
  2. 提交的条目
  3. 父母不重定向
  4. 弹出窗口被重定向

代码

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);

问题:

  1. 用于在 windows 2003 server 中工作的代码
  2. 迁移到 2008,它不再工作了
4

1 回答 1

0

我假设您正在使用 javascript,所以我在这里写

在此处查看我的答案 如何关闭当前浏览器窗口并重定向到同一浏览器先前打开的窗口

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);

它说明 self.close() 当前将被关闭并且新 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);

把这个放在你弹出的提交点击中所以会发生什么是父级将被重定向并且当前窗口将被关闭注意:此代码未经测试我希望这对你有所帮助... :)

于 2013-10-16T04:44:55.403 回答