简体   繁体   English

重定向父级-关闭弹出窗口-ASP

[英]Redirect Parent - Close Popup - ASP

I need help in redirecting parent page from clicking a submit button in its popup window 我需要帮助来重定向父页面,方法是单击其弹出窗口中的“提交”按钮

Should happen: 应该发生:

  1. User hits submit button, parameters from popup will be passed in a url 用户点击“提交”按钮,弹出窗口中的参数将在url中传递
  2. Parent page will redirect to Details page 父页面将重定向到“详细信息”页面
  3. popup window closed 弹出窗口关闭

What happens: 怎么了:

  1. User hits submit button, parameters from popup will be passed in a url 用户点击“提交”按钮,弹出窗口中的参数将在url中传递
  2. Entries submitted 参赛作品已提交
  3. Parent does not redirect 父母不重定向
  4. popup window gets redirected instead 弹出窗口改为重定向

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: 问题:

  1. Code used to work in windows 2003 server 用于Windows 2003 Server的代码
  2. migrated to 2008 and it's not working anymore 迁移到2008年,它不再工作了

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.

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