Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在网格视图按钮上打开新窗口单击aspx.cs页面?_C#_Javascript_Asp.net - Fatal编程技术网

C# 在网格视图按钮上打开新窗口单击aspx.cs页面?

C# 在网格视图按钮上打开新窗口单击aspx.cs页面?,c#,javascript,asp.net,C#,Javascript,Asp.net,我正在处理aspx.cs页面。当我单击网格按钮列时,应该会将一些数据从当前页面移到新页面,并将其打开到新窗口,而不会破坏当前窗口 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Trans") { Response.Redirect("APIwiserecharge.aspx?DisplayID="

我正在处理aspx.cs页面。当我单击网格按钮列时,应该会将一些数据从当前页面移到新页面,并将其打开到新窗口,而不会破坏当前窗口

   protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  {
    if (e.CommandName == "Trans")
    {

      Response.Redirect("APIwiserecharge.aspx?DisplayID=" +
       objdl.Encode(e.CommandArgument.ToString()));
    }

  }

要从codebehind打开新窗口,需要使用javascript。您需要使用javascript处理单击事件。您可以为您的codebehind尝试以下代码:

  protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
  {
    if (e.CommandName == "Trans")
    {

       string url = "APIwiserecharge.aspx?DisplayID=" +objdl.Encode(e.CommandArgument.ToString());

       string s = "window.open('" + url + "', 'popup_window', 'width=300,height=100,left=100,top=100,resizable=yes');";

        ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
    }

  }
试试这个

ScriptManager.RegisterStartupScript(this, this.GetType(), "onclick", "javascript:window.open( 'APIwiserecharge.aspx','_blank','height=600px,width=600px,scrollbars=1');", true);

你想用updatePanel来显示数据吗?不,先生,我想打开一个新的ASPX页面。它不工作。所以请给我另一个。请。