Creating a pop-up window

S

Steve Caliendo

Hi,

In the Page_Load sub, can someone tell me what code to place to create a
pop-up window?

Thanks,

Steve
 
M

Mark Fitzpatrick

Steve,
Remember, the Page_Load event is a server-side event, it won't
actually raise client-side events such as a pop-up. Basically, you'll still
create pop-up windows the same way you did before, with client-side
javascript. You can, of course, cause the server tags that are written by
ASP.Net to contain calls to these functions, but the server events don't
directly call the functions or activate them. For instance: you have a
client-side function called ShowPopUp. You create the Body tag as an
HtmlGenericControl by naming it and adding the runat=server attribute to it.
Then, in the Page_Load you can add an attribute caled OnLoad and set the
value to the attribute to be whatever you would need to call the client-side
pop-up.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
S

Steve C. Orr [MVP, MCSD]

You can open a new window using client side javascript such as this:
a=window.open('SomePage.aspx','MyWindow')
Here's more info:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp

You can use the RegisterClientScriptBlock or RegisterStartupScript
functions to help you output the javascript from your server code, such as
in your Page_Load event.
Here's more info on these:
http://msdn.microsoft.com/library/d...UIPageClassRegisterClientScriptBlockTopic.asp
http://msdn.microsoft.com/library/d...mWebUIPageClassRegisterStartupScriptTopic.asp
 

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
473,951
Messages
2,570,113
Members
46,698
Latest member
alexxx

Latest Threads

Top