【问题标题】:Adding new window Properties in Response.Redirect在 Response.Redirect 中添加新窗口属性
【发布时间】:2018-01-05 07:36:59
【问题描述】:

我在 Response.Redirect 的帮助下将以下用于重定向到另一个页面的 javascript 代码转换为 c# 代码(服务器端)

javascript 是这样的。

function GetBillDetails() {
    var childWindow = null;
    var SelVal = ddl.options[ddl.selectedIndex].value;
    var SelText = ddl.options[ddl.selectedIndex].text;
    childWindow = window.open('../Mine/MyPrint.aspx?BillNo=' + SelVal + '&Bill=' + SelText +, "MainForm", "width=725px,height=530px,left=150px,top=50px,scrollbars=no,toolbars=no,resizable=no")
}

而带有 Response.Redirect 的 C# 代码是,

string BillNo = "255", Bill = "CG2/78";
Response.Redirect("../Mine/MyPrint.aspx?BillNo=" + BillNo + "&Bill='" + Bill + ");

它工作正常。但我的问题是如何在 Response.Redirect 中添加这些新窗口属性,如 javascript 代码中使用的那样

"width=725px,height=530px,left=150px,top=50px,scrollbars=no,toolbars=no,resizable=no"

【问题讨论】:

标签: javascript c#


【解决方案1】:

试试这个,而不是 response.redirect:

Response.write("<script>");
Response.write("window.open('YOUR_PAGE_WITH_PARAM','_blank')");
Response.write("</script>");

Response.Write("<script language='javascript'> window.open('YOUR_PAGE_WITH_PARAM', 'window','HEIGHT=600,WIDTH=820,top=50,left=50,toolbar=yes,scrollbars=yes,resizable=yes');</script>");

【讨论】:

  • 但它没有重定向。我用了上面推荐的文章
  • 我之前试过这段代码,但什么也没发生。它没有显示任何错误,但没有弹出。
  • 感谢您的关注,但我已经从 Subhash 帖子中获得了解决方案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-12-30
  • 1970-01-01
  • 2021-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-01
相关资源
最近更新 更多