How to open a new browser

W

Wenye Shi

Hi,

I am using ASP.net to develop a web application. In some
cases, I would like to open a new browser on the client
when the user click a button or the linkbutton. The
button and linkbutton are server controls. Is there a
way to accomplish that, if so, would you let me know?

Thanks

Wenye Shi
 
K

Ken Cox [Microsoft MVP]

In the codebehind, you just need to add an attribute to the button for the
onclick event and a little JavaScript to go with it:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim blnDoPopUp As Boolean
blnDoPopUp = True
If blnDoPopUp Then
LinkButton1.Attributes.Add _
("onclick", "window.open('http://www.aspalliance.com/kenc');" & _
"return false;")
Button1.Attributes.Add _
("onclick", "window.open('http://www.aspalliance.com/kenc');" & _
"return false;")
End If
End Sub

Does this help?

Ken
MVP [ASP.NET]


--
Microsoft MVPs have a question for *you*: Are you patched against the Worm?
http://www.microsoft.com/security/security_bulletins/ms03-026.asp



Hi,

I am using ASP.net to develop a web application. In some
cases, I would like to open a new browser on the client
when the user click a button or the linkbutton. The
button and linkbutton are server controls. Is there a
way to accomplish that, if so, would you let me know?

Thanks

Wenye Shi
 

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

No members online now.

Forum statistics

Threads
474,077
Messages
2,570,566
Members
47,202
Latest member
misc.

Latest Threads

Top