Spawn New Browser Using LinkButton Control

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.
 
H

hb

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?
 
D

DM

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.
 
H

hb

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');");
 
D

DM

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');");
 
D

DM

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top