I ran into the same problem today.
Response.write did not work for me, to solve this problem I used System.Web.UI.ScriptManager.RegisterClientScriptBlock.
This is how the btnSave click event should be:
protected void btnSave_Click(object sender, EventArgs e) { ...//some code to insert records System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "openModal", "window.open('NewQuote.aspx?val= "+ this.txtQuotationNo.Text+"' ,'_blank');", true); }
NOTE. I use ScriptManager.RegisterClientScriptBlock because the button is inside the UpdatePanel. If this is not your case, try:
protected void btnSave_Click(object sender, EventArgs e) { ...//some code to insert records Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "openModal", "window.open('NewQuote.aspx?val= " + this.txtQuotationNo.Text + "' ,'_blank');", true); }
source share