【问题标题】:How to Use Target="_Blank" in Respnse.redirect() in c#如何在 C# 的 Response.redirect() 中使用 Target="_Blank"
【发布时间】:2014-04-14 10:27:20
【问题描述】:

我正在创建一个网站,我在其中添加了一个 Paypal 按钮。付款成功后我想在同一页面上。所以我希望付款处理应该在新标签中完成。我的书面代码如下:-

protected void Button7_Click(object sender, EventArgs e)
{
    string business = "rajpadwa@gmail.com";
    string itemName = "Funds";
    int itemAmount = Int32.Parse(DropDownList1.SelectedItem.Value);
    string currencyCode = "USD";

    StringBuilder ppHref = new StringBuilder();

    ppHref.Append("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick");
    ppHref.Append("&business=" + business);
    ppHref.Append("&item_name=" + itemName);
    ppHref.Append("&amount=" + itemAmount.ToString("#.00"));
    ppHref.Append("&currency_code=" + currencyCode);

    Response.Redirect(ppHref.ToString(), true);
}

你能告诉我如何在使用Response.Redirect() Method...时在新标签中进行贝宝交易

【问题讨论】:

    标签: c# asp.net paypal


    【解决方案1】:

    尝试如下客户端代码

    string newScript = "<script language='javascript'>window.open('" + ppHref.ToString() + "', '_blank');</script>";
    Page.ClientScript.RegisterClientScriptBlock(this.GetType, "NewWindow", newScript);
    

    【讨论】:

      猜你喜欢
      • 2023-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 2021-01-16
      相关资源
      最近更新 更多