peterdoherty Posted March 2, 2003 Posted March 2, 2003 Hi there does anyone know how to close a pop up from the back end vb code (ie the .aspx.vb code file) of a webform?? Cheers Peter Quote
*Gurus* Derek Stone Posted March 2, 2003 *Gurus* Posted March 2, 2003 Have the code-behind output the appropriate JavaScript, window.close(), to the page. The location to output the JavaScript all depends on what you're trying to accomplish. Quote Posting Guidelines
peterdoherty Posted March 2, 2003 Author Posted March 2, 2003 Well what I am doing is opening a window with code executing behind it when it opens up. I would like to close the window once this code has finshed executing. Below is the .aspx.vb Public Class DeleteAppointment Inherits System.Web.UI.Page Dim iAppointmentID As Integer Dim sAppointmentType As String #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here iAppointmentID = Page.Request.QueryString("Appointment_ID") sAppointmentType = Page.Request.QueryString("Type") DeleteAppointment() '**** I WOULD LIKE TO CLOSE THE WINDOW HERE ********* End Sub Private Sub DeleteAppointment() Dim oDBHandler As New DBHandler() Dim sSql As String sSql = "Delete from [" & sAppointmentType & "] where appointment_id =" & iAppointmentID If oDBHandler.Connect = True Then If oDBHandler.ExecuteSQLCommand(sSql) = False Then 'error End If oDBHandler.EndConnection() Else 'error connecting End If oDBHandler = Nothing End Sub End Class Quote
*Gurus* Derek Stone Posted March 2, 2003 *Gurus* Posted March 2, 2003 I don't understand why you'd want to do things like this, but I don't really need to know, do I? :) Forget about the code-behind and add the following to the ASP.NET page itself: <html> <head> <title>Demo</title> </head> <body onload="window.close()"> </body> </html> Quote Posting Guidelines
peterdoherty Posted March 2, 2003 Author Posted March 2, 2003 cheers. Thats worked a treat! I would explain exactly what i'm doing but i dont have the time unfortuatly Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.