Spawn New Browser Using LinkButton Control

  • Thread starter Thread starter DM
  • Start date Start date
D

DM

Using the LinkButton control on a web form, how can I make the clicking of it open a new browser instance? I know how to do it with the normal anchor tag, but not this ASP.NET control.
 
DM said:
Using the LinkButton control on a web form, how can I make the clicking of it open
a new browser instance? I know how to do it with the normal anchor tag,
but not this ASP.NET control.

Do you want it to call the click event handler and then open a new browser
window, or do you just want a new browser window?
 
I would like it to call the click event handler to execute some code, then
redirect to another page, but the other page is in the new browser window.
 
DM said:
I would like it to call the click event handler to execute some code, then
redirect to another page, but the other page is in the new browser window.

As the last line of code in click event, add code like this:

Page.RegisterClientScriptBlock("newWin", "window.open(" + url + ",
'windowName', 'args-you fill in');");
 
Thanks! I'll give it a try.


hb said:
window.

As the last line of code in click event, add code like this:

Page.RegisterClientScriptBlock("newWin", "window.open(" + url + ",
'windowName', 'args-you fill in');");
 
Thanks for the advice below. I think it mostly works, except for one minor
issue. My url is actually a page that is one directory/folder up (i.e.,
...\page.aspx). But, the line of code below doesn't like this when I put it
in for url.

Would you know how to make this work?

Thanks again.
 
Back
Top