Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

How to close popup window

$
0
0

I'm using Visual Web Developer 2010 Express with SQL Server 2008 Express, VB.

A two part question:

1. I have an area where I want to open a popup window, indicating work in progress, and after the work is completed automatically close the window.  My code is below and opens the window fine but does not close it.  Hopefully someone has a solution for me.

2. How can I change the window.open to center the popup rather than specifying coordinates?

    Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
        Dim script As String = "window.open('Test3.aspx','_blank','height=200,width=300,left=250,top=250,scrollbars=no,toolbar=no, directories=no, status=no, menubar=no, resizable=no, copyhistory=no');"
        ScriptManager.RegisterStartupScript(Me, Me.GetType(), "popup", script, True)


        System.Threading.Thread.Sleep(8000)   'In reality doing other tasks at this point

        Dim script1 As String = "window.close();"
        System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, Me.[GetType](), "CloseWindow", script1, True)


    End Sub

Thanks!


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>