C# 脚本管理器无法在c中的新窗口中打开aspx页#
下面是我的代码C# 脚本管理器无法在c中的新窗口中打开aspx页#,c#,C#,下面是我的代码 protected void btnprnt_Click(object sender, EventArgs e) { //Response.Redirect("Print.aspx"); string url = "Print.aspx?ID=1&cat=test"; string script = "window.open('" + url + "','')"; if (!ClientScript.IsClientScriptBlock
protected void btnprnt_Click(object sender, EventArgs e)
{
//Response.Redirect("Print.aspx");
string url = "Print.aspx?ID=1&cat=test";
string script = "window.open('" + url + "','')";
if (!ClientScript.IsClientScriptBlockRegistered("NewWindow"))
{
//clientScript.RegisterClientScriptBlock(this.GetType(), "NewWindow", script, true);
ScriptManager.RegisterClientScriptBlock(this,this.GetType(), "NewWindow", script, true);
}
}
问题是我的Print.aspx未在新窗口中打开。页面已打开,但不在新窗口中。
甚至页面正在重定向。您的
窗口的参数。打开功能不正确。第二个参数覆盖目标属性,您应该删除它
string script = "window.open('" + url + "')";
窗口.打开
功能的参数不正确。第二个参数覆盖目标属性,您应该删除它
string script = "window.open('" + url + "')";
您需要以下内容
string script = "window.open('" + url + "','_blank')";
您需要以下内容
string script = "window.open('" + url + "','_blank')";