Though arshadras have define you a real simple way to do this, but If you want to use code behind for opening popup . check this out
http://www.codeproject.com/aspnet/asppopup.asp
cheers
Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
http://www.aghausman.net
calvinkwoo30...
Member
223 Points
114 Posts
Pop up Window When Page Load
Mar 26, 2007 11:33 AM|LINK
I am using VB.Net.
I want to Pop Up a window when the page is load.
Private
Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadPopUp a window here without using Javascript
End Sub
Anyone can help me?
arshadras
Participant
960 Points
165 Posts
Re: Pop up Window When Page Load
Mar 26, 2007 12:18 PM|LINK
<script language="JavaScript">
function PopUp()
{
var URL = "./index2.php";
var Name = "popup";
var Fensteroptionen = "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0";
var Breite = 800;
var Hoehe = 600;
window.open(URL, 'Name', Fensteroptionen + ',width=' + Breite + ',height=' + Hoehe);
}
//-->
</script>
</head>
<body onload=PopUp();>
hope this will help
Free ASP.Net & Ajax books
Please mark the most helpful reply/replies as "Answer".
aghausman12
Contributor
3035 Points
550 Posts
Re: Pop up Window When Page Load
Mar 26, 2007 12:29 PM|LINK
Though arshadras have define you a real simple way to do this, but If you want to use code behind for opening popup . check this out
http://www.codeproject.com/aspnet/asppopup.asp
cheers
http://www.aghausman.net
Haissam
All-Star
37421 Points
5632 Posts
Re: Pop up Window When Page Load
Mar 26, 2007 12:53 PM|LINK
If you are using ASP.NET 2.0 use
Page.ClientScript.RegisterStartUpScript(me.GetType(),"popup","<script language=javascript>window.open('WebForm2.aspx','','width=300px,height=200px')</script>")
if you are using ASP.NET 1.X
Page.RegisterStartUpScript("popup","<script language=javascript>window.open('WebForm2.aspx','','width=300px,height=200px')</script>")
HC
MCAD.NET
| Blog |
calvinkwoo30...
Member
223 Points
114 Posts
Re: Pop up Window When Page Load
Mar 27, 2007 08:22 AM|LINK
Thanks a lot to everyone.
If i using javascript it will block the pop up.
then i try to use
Page.RegisterStartUpScript("popup","<script language=javascript>window.open('WebForm2.aspx','','width=300px,height=200px')</script>")
but nothing pop up in this coding.
i put it on the PageLoad.
Can anyone tell me how to pop up a window without block by pop-up-blocker.
calvinkwoo30...
Member
223 Points
114 Posts
Re: Pop up Window When Page Load
Mar 27, 2007 08:26 AM|LINK
Thanks a lot to everyone.
If i using javascript it will block the pop up.
then i try to use
Page.RegisterStartUpScript("popup","<script language=javascript>window.open('WebForm2.aspx','','width=300px,height=200px')</script>")
but nothing pop up in this coding.
i put it on the PageLoad.
Can anyone tell me how to pop up a window without block by pop-up-blocker.
JoshStodola
Star
13736 Points
3177 Posts
Re: Pop up Window When Page Load
Mar 27, 2007 04:16 PM|LINK
Make your <body> tag server accessible:
And try the following code in your Page_Load:
This works fine here in ASP.NET 2.0
Hope this helps! Don't forget to mark the most helpful post(s) as Answer for the sake of future readers. Thanks!
zapdafish
Member
35 Points
15 Posts
Re: Pop up Window When Page Load
Mar 27, 2007 04:54 PM|LINK
calvinkwoo30...
Member
223 Points
114 Posts
Re: Pop up Window When Page Load
Mar 28, 2007 02:09 AM|LINK
Thanks JoshStodola,
Is it it only work on ASP.NET 2.0 ??
I tried, but it is errror say that Body is not defined!!
Is there a way to solve it??
JoshStodola
Star
13736 Points
3177 Posts
Re: Pop up Window When Page Load
Mar 28, 2007 02:34 AM|LINK
Yeah, its ASP 2.0, but trying this could fix your problem (untested):
Hope this helps!