Response.Redirect vs Window.Open

  • Thread starter Thread starter margaret
  • Start date Start date
M

margaret

James suggested that I used window.open on the client side
to open a new window. I created a test ASP app and can
get it work fine. But now I'm trying to fix my real app,
which is in ASP.NET. It uses a button with the button
handler in the C# code-behind page calling
Response.Redirect. I can't find anything that's
equivalent to window.open and I don't know enough about
ASP to figure out how or where to put the window.open and
still run all the other stuff that's happening in my click
handler. If I knew what to look up or what class it lives
in I can probably find it in the docs. Can somebody point
me in the right direction?

Thanks
 
ASP.NET cannot control the browser's behavior. All it is responsible for is
fabricating the HTML used to render. If you want some action done on the
browser, such as opening a new window, you will need to send that script
down to the client for execution.
 
1. Turn off runat=server on the button. You may need to change it from
an <asp: control to a normal web control <button??

2. In the onclick event of the new control, have it do a window.open
using the properties you would like, and using the page that you
wanted to redirect to as the URL. That page can, of course, be an aspx
file as well.
 
Back
Top