2012-02-03 30 views
1

下面是我的代碼腳本管理器無法在C#中打開新的窗口aspx頁面

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是不是在新窗口中打開。
頁面已打開,但未在新窗口中打開。連頁面正在重定向。

回答

0

您的window.open函數參數不正確。第二個參數是覆蓋目標屬性,你應該刪除它。

string script = "window.open('" + url + "')"; 
1

您需要以下

string script = "window.open('" + url + "','_blank')"; 
相關問題