C# 在网格视图按钮上打开新窗口单击aspx.cs页面?
我正在处理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="
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页面。它不工作。所以请给我另一个。请。