Thursday, March 22, 2012

Trouble with popups

I have a aspx page and I want to do a popup to another page when my page is loaded and when click a button into a data grid. How can I do it ?

I have tried the next but It don`t work.
with a button out of a datagrid it works fine.

miboton is the name of a button in an itemtemplate into a datagrid. The compiler not recognize the name of the control. Why is it in a datagrid??

thanks in advance

Sub Page_Load(sender As Object, e As EventArgs)
openpopup(miboton,"http://www.baanfans.com", "ventana", 200, 300)
end Sub

Sub OpenPopUp(ByVal opener As System.Web.UI.WebControls.WebControl, ByVal PagePath As String, ByVal windowName As String, ByVal width As Integer, ByVal height As Integer)

Dim clientScript As String
Dim windowAttribs As String

windowAttribs = "width=" & width & "px," & _
"height=" & height & "px," & _
"left='+((screen.width -" & width & ") / 2)+'," & _
"top='+ (screen.height - " & height & ") / 2+'"

clientScript = "window.open('" & PagePath & "','" & windowName & "','" & windowAttribs & "');return false;"
opener.Attributes.Add("onclick", clientScript)

End SubMaybe you can take a look atthis control.

Grz, Kris.
Hello, you would like to check this link:Pop Up Window.

Good Luck.
the code that I posted above works fine. The trouble is what I want is to do a pop up when my page is loaded and click a button that it is in an item template. I have any trouble to do the popup with a button alone.

thanks for your reply.
Hello, could u please check this article.Embedding Java Scripts in ASP.NET

Good Luck.

0 comments:

Post a Comment