Reputation: 707
below is my Code
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);
}
}
Problem is my Print.aspx is not open in new window.
the page is open but not in new window.
even page is redirecting.
Upvotes: 1
Views: 2363
Reputation: 4949
You need the following
string script = "window.open('" + url + "','_blank')";
Upvotes: 1
Reputation: 34349
Your parameters for the window.open
function are incorrect. The second parameter is overriding the target attribute, you should remove this.
string script = "window.open('" + url + "')";
Upvotes: 0