Thursday, March 22, 2012

open a popup window from.net code behind

Hi

I am trying to open a new window from a button in my aspx side. This works, but I have to push the button 2 times before it open. Any idea?

Public Shared Sub OpenPopUp(ByVal opener As System.Web.UI.WebControls.WebControl, ByVal PagePath As String)
Dim clientScript As String

'Building the client script- window.open
clientScript = "window.open('" & PagePath & "')"
'register the script to the clientside click event of the opener control
opener.Attributes.Add("onClick", clientScript)
End Sub

Sub Button1_Click(sender As Object, e As EventArgs)
OpenPopup(Button1,"http://www.google.com")
End SubHello, please check my BLOG below, I have an article I posted it there that explains how to open a pop up window from inside asp.net.

regards
Thanks

But, What if you want to execute some server-side code before calling the client-side. Thats what I need to do.
Hi, I advise you to check this post :view post 818881

regards

0 comments:

Post a Comment