Close a pop-window after submit is complete?

K

Kathy Burke

I see plenty of examples of window.close javascript for a button or link
click, but I would like to do is close the pop-up window when my submit
code has completed successfully.

Any suggestions?

Thanks.

Kathy
 
V

Vidar Petursson

Hi

Return a script to the client on post success
<script>window.close();</script>

--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
 
K

KathyB

Vidar Petursson said:
Hi

Return a script to the client on post success
<script>window.close();</script>
Thanks, Vidar. Where do I put this exactly? Right now my submit button
is a standard asp:button that runs an onclick event.???

Kathy
 
M

Munsifali Rashid

KathyB said:
"Vidar Petursson" <[email protected]> wrote in message
Thanks, Vidar. Where do I put this exactly? Right now my submit button
is a standard asp:button that runs an onclick event.???

Kathy


In the postback server event, try putting the following:

Eg - assuming you're using VB.NET -

Sub Button1_Click(ByVal Sender As Object, ByVal E As EventArgs) Handles
Button1.Click

'Your code here

'Write script to the page to close this window
Response.Write("<script>window.close()</script>")

End Sub


Hope this helps,

Mun
 

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
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top