Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Re: How to open a new browser window using code-behind?


Message #1 by "Pierre Huguet" <pierre@h...> on Wed, 24 Apr 2002 07:45:12
Response.Write will not work inside an event because it will write before 
the begining of the html of the page.

But you can do the following:

1- Inside your html page add  <DIV id=invisiblePanel runat=server ><DIV> .

2- Then in the code-behind event of your choice (button_click...) 
 put your version of the following code.

string strYourLink= "www.microsoft.com";
string strScript = "<script language=javascript>\n";
strScript += "window.open('" + strYourLink + "');\n";
strScript += "</script>\n";
invisiblePanel.InnerHtml = strScript; 

That's it!

  Return to Index