≡ Menu

How to open webform in new popup brower window from code behind

PopUp form can be open through two ways from code behind, you can use both way , parameters can be send through Query string as well


protected void Button1_Click(object sender, EventArgs e){
OpenNewWindow(”test.aspx”);
OpenNewWindowUsingResponse("test.aspx");
}

public void OpenNewWindow(string url)
{
ClientScript.RegisterStartupScript(this.GetType(), “newWindow”, String.Format(”<script>window.open(’{0}’);</script>”, url));
}

Public Void OpenNewWindowUsingResponse(string Url)
{
Response.Write("<scr" + "ipt>rn");
Response.Write("open('" + Url + "');rn");
Response.Write("</scr" + "ipt>");

}

Both Works fine

{ 0 comments… add one }

Leave a Comment