[C#] Open webform in new browser window from C# codebehind page


Found a great little snip of code online today from csharphelp.com about how to open a new browser window from a C# codebehind:

Response.Write("<SCRIPT language=javascript>var w=window.open('Rpt_OrderStatus_Form.aspx','OrderStatus','height=800,width=800');</SCRIPT>");

…but, one of the comments on that thread is that the Response.Write disrupts the page appearance. Any thoughts/suggestions on a better way to open a new browser window from a C# codebehind?

2 thoughts on “[C#] Open webform in new browser window from C# codebehind page

  1. Try this:

    ClientScript.RegisterStartupScript( this.GetType(), “PopupWindow”, “var w=window.open(‘Rpt_OrderStatus_Form.aspx’,’OrderStatus’,’height=800,width=800′);” );

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s