Creating popups

G

Guest

Help! I’m trying to get popups to work in asp.net. I’m Using the following
javascript code in a sub, but I can’t get the PopupWindow to work. At
first I thought the routine wasn’t working but it is. It looks like it’s the
window.open that’s not working. I have site popup allowed turned on, if I
replace window.open with alert it works, if I put the code in the html code
it works. Any suggestions?

Dim PopupScript As String = "<script language='javascript'>" & _
"window.open('popup.aspx', 'CustomPopUp', " & _
"'height=550, width=550, menubar=no, resizable=no');" & _
"</script>"
Me.RegisterStartupScript("PopupScript", PopupScript)
 
J

John Timney \(Microsoft MVP\)

try this code ............

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP

<html>
<head>
<script language="VB" runat="server">

Sub Page_Load( sender as Object,e as EventArgs)

'Form the script that is to be registered at client side.
Dim scriptString as String = "<script language=JavaScript> function
DoClick() {"
ScriptString +=
"window.open('http://www.mvps.org','MyWindow','width=500,height=500');}<"
scriptString += "/"
scriptString += "script>"

If(Not IsClientScriptBlockRegistered("clientScript"))
RegisterClientScriptBlock("clientScript", scriptString)
End If
End Sub
</script>
</head>
<body topmargin="20" leftmargin="10">
<form id="myForm" runat="server">

<INPUT id="launchButton" onclick="DoClick();" type="button"
value="Submit" name="myButton" runat="server">

</form>
</body>
</html>
 
P

Peter Rilling

Also, make sure popup blockers are disabled. They might interfere with this
code.
 

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

Top