Creating a pop-up window

  • Thread starter Thread starter Steve Caliendo
  • Start date Start date
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
 
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
 
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
 
Back
Top