Close a window after button click

S

Steve

The user clicks a buuton and the server does some
processing. If successful I want to close the window.

Any suggestions?


Steve
 
K

Karl Seguin

you could simply Response.Write the javascript to do a self.close() ala:

Response.Write ("<script language='javascript'>self.close();</script>")

A more elegant solution might be to use Page.RegisterStartupScript

Karl
 
K

Kevin Spencer

Use Page.RegisterStartupScript() to add the following JavaScript to the
page:

window.opener = self;
window.close();

It will close as soon as it reloads after the PostBack.

HTH,

Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
http://www.takempis.com
Big things are made up of
lots of Little things.
 

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

Forum statistics

Threads
474,078
Messages
2,570,572
Members
47,204
Latest member
MalorieSte

Latest Threads

Top