【问题标题】:asp.net redirect to new window and passing valueasp.net 重定向到新窗口并传递值
【发布时间】:2017-09-06 12:50:43
【问题描述】:

我有一个 gridview 和一个链接按钮,我想在单击链接按钮时将用户重定向到另一个页面。 但是我在像这样重定向用户时传递了一个值

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "cat")
    {
        Response.Redirect("coverLetter.aspx?cat=" + e.CommandArgument);
    }
}

这很好,但我想将用户重定向到一个新窗口,让旧窗口保持活动状态 我怎样才能做到这一点? 我已经试过了

Response.Write("<script>window.open('coverLetter.aspx'/,'_blank');</script>");

但我不能以这种方式传递值。 知道如何解决这个问题吗?

【问题讨论】:

    标签: javascript jquery asp.net gridview


    【解决方案1】:

    您可以使用所需的参数构建windows.open 字符串。例如:

    Response.Write("<script>window.open('coverLetter.aspx?cat=" + e.CommandArgument + "','_blank' ,'height=300,width=300');</script>")
    

    【讨论】:

      猜你喜欢
      • 2013-05-29
      • 2015-04-17
      • 2011-06-24
      • 1970-01-01
      • 1970-01-01
      • 2010-09-11
      • 1970-01-01
      • 1970-01-01
      • 2014-08-28
      相关资源
      最近更新 更多