|
 |
aspx_beginners thread: Closing a window without using Javascript
Message #1 by Ronnie Tripplett <rtripplett@a...> on Wed, 10 Apr 2002 14:11:26 -0500
|
|
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #2 by "Peter" <petemail@r...> on Wed, 10 Apr 2002 23:35:33 -0400
|
|
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #3 by Ronnie Tripplett <rtripplett@a...> on Thu, 11 Apr 2002 08:47:18 -0500
|
|
Thanks.
I take it that there is no other way!
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Wednesday, April 10, 2002 10:36 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #4 by "Peter" <petemail@r...> on Thu, 11 Apr 2002 17:04:20 -0400
|
|
javascript is the best way.
Sorry about my smartass comment before, I couldn't resist!
-----Original Message-----
From: Ronnie Tripplett [mailto:rtripplett@a...]
Sent: Thursday, April 11, 2002 9:47 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
Thanks.
I take it that there is no other way!
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Wednesday, April 10, 2002 10:36 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #5 by "McCloy, Russell" <Russell.McCloy@B...> on Fri, 12 Apr 2002 08:37:23 +1000
|
|
Is that what that X is for?
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Thursday, 11 April 2002 1:36 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #6 by "McCloy, Russell" <Russell.McCloy@B...> on Fri, 12 Apr 2002 08:37:22 +1000
|
|
<script language=javascript>
function closeYourWin()
{
window.close()
}
</script>
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Friday, 12 April 2002 7:04 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
javascript is the best way.
Sorry about my smartass comment before, I couldn't resist!
-----Original Message-----
From: Ronnie Tripplett [mailto:rtripplett@a...]
Sent: Thursday, April 11, 2002 9:47 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
Thanks.
I take it that there is no other way!
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Wednesday, April 10, 2002 10:36 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #7 by Ronnie Tripplett <rtripplett@a...> on Fri, 12 Apr 2002 16:06:00 -0500
|
|
Russell,
In my .aspx page, I get the following error:
closeYourWin is not a member of 'ASP.Sample_aspx'
It appears that this page does not recognize javascript functions at all. I
know that this is a simple issue, but its kicking mine!
Any additional help provided will be greatly appreciated.
-----Original Message-----
From: McCloy, Russell [mailto:Russell.McCloy@B...]
Sent: Thursday, April 11, 2002 5:37 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
<script language=javascript>
function closeYourWin()
{
window.close()
}
</script>
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Friday, 12 April 2002 7:04 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
javascript is the best way.
Sorry about my smartass comment before, I couldn't resist!
-----Original Message-----
From: Ronnie Tripplett [mailto:rtripplett@a...]
Sent: Thursday, April 11, 2002 9:47 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
Thanks.
I take it that there is no other way!
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Wednesday, April 10, 2002 10:36 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #8 by "McCloy, Russell" <Russell.McCloy@B...> on Mon, 15 Apr 2002 08:19:40 +1000
|
|
It seems like your script is trying to run on the server and not client
side.
Can you send me more of your code.
russell.mccloy@b...
are you using visual studio.NET?
thanks
RUSs
-----Original Message-----
From: Ronnie Tripplett [mailto:rtripplett@a...]
Sent: Saturday, 13 April 2002 7:06 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
Russell,
In my .aspx page, I get the following error:
closeYourWin is not a member of 'ASP.Sample_aspx'
It appears that this page does not recognize javascript functions at all. I
know that this is a simple issue, but its kicking mine!
Any additional help provided will be greatly appreciated.
-----Original Message-----
From: McCloy, Russell [mailto:Russell.McCloy@B...]
Sent: Thursday, April 11, 2002 5:37 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
<script language=javascript>
function closeYourWin()
{
window.close()
}
</script>
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Friday, 12 April 2002 7:04 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
javascript is the best way.
Sorry about my smartass comment before, I couldn't resist!
-----Original Message-----
From: Ronnie Tripplett [mailto:rtripplett@a...]
Sent: Thursday, April 11, 2002 9:47 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
Thanks.
I take it that there is no other way!
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Wednesday, April 10, 2002 10:36 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #9 by Ronnie Tripplett <rtripplett@a...> on Mon, 15 Apr 2002 10:31:26 -0500
|
|
Here's the code for both the vb as well as the .aspx. It seems that the vb
code doesn't recognize the "closeYourWin()" function call because vs.net
complains that closeYourWin is not declared. I would rather this page close
automatically after its done with the storedproc rather than relying on the
user to press a close window button. Thanks for looking into this issue and
providing help.....
In the Sample.aspx.vb......
Sub InsertIntoDB(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim WOConn As System.Data.SqlClient.SqlConnection = New
System.Data.SqlClient.SqlConnection("Data Source=pub;uid=sa;pwd=;Initial
Catalog=pub")
Dim insertCmd As System.Data.SqlClient.SqlCommand = New
System.Data.SqlClient.SqlCommand("sp_Insert", WOConn)
insertCmd.CommandType =CommandType.StoredProcedure
Dim myP1 As SqlClient.SqlParameter = insertCmd.Parameters.Add("@SubmitDate",
SqlDbType.VarChar, 22)
myP1.Value = Session("SubmitDate")
Dim myP2 As SqlClient.SqlParameter = insertCmd.Parameters.Add("@RefNum",
SqlDbType.NVarChar, 20)
myP2.Value = Session("RefNum")
Dim myP2a As SqlClient.SqlParameter = insertCmd.Parameters.Add("@Submitter",
SqlDbType.NVarChar, 30)
myP2a.Value = Session("Submitter")
Dim myP3 As SqlClient.SqlParameter
insertCmd.Parameters.Add("@SubmitterNum", SqlDbType.NVarChar, 30)
myP3.Value = Session("SubmitterNum")
Dim myP4 As SqlClient.SqlParameter = insertCmd.Parameters.Add("@UserName",
SqlDbType.NVarChar, 30)
myP4.Value = Session("UserName")
Dim myP5 As SqlClient.SqlParameter = insertCmd.Parameters.Add("@UserNum",
SqlDbType.NVarChar, 30)
myP5.Value = Session("UserNum")
WOConn.Open()
Dim myInsertRdr As SqlClient.SqlDataReader = insertCmd.ExecuteReader()
myInsertRdr.Close()
woconn.Close()
SendEmail(0,e)
wonC(0,e)
closeYourWin()
End Sub
In the sample.aspx.......
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Sample.aspx.vb"
Inherits="ihd_hd.Sample"%>
<HTML>
<HEAD>
<title>Sample</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function closeYourWin()
{
JavaScript:window.top.close()
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<h2>
<asp:Button id="btnSave" style="Z-INDEX: 103; LEFT: 156px;
POSITION: absolute; TOP: 109px" runat="server" Text="Submit Work Order Now"
OnClick="InsertIntoDB"></asp:Button>
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 53px;
POSITION: absolute; TOP: 168px" runat="server"
Visible="False"></asp:TextBox>
<font color="#0000ff" style="COLOR: blue; BACKGROUND-COLOR:
#ffffff">The Work Order Information for Work Order #
<%=Session("RefNum")%>
Will be Submitted! </font>
<br>
<br>
<font color="#0000ff" style="COLOR: blue; BACKGROUND-COLOR:
#ffffff">Press the
Submit Button!! </font>
</h2>
</form>
</body>
</HTML>
-----Original Message-----
From: McCloy, Russell [mailto:Russell.McCloy@B...]
Sent: Sunday, April 14, 2002 5:20 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
It seems like your script is trying to run on the server and not client
side.
Can you send me more of your code.
russell.mccloy@b...
are you using visual studio.NET?
thanks
RUSs
-----Original Message-----
From: Ronnie Tripplett [mailto:rtripplett@a...]
Sent: Saturday, 13 April 2002 7:06 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
Russell,
In my .aspx page, I get the following error:
closeYourWin is not a member of 'ASP.Sample_aspx'
It appears that this page does not recognize javascript functions at all. I
know that this is a simple issue, but its kicking mine!
Any additional help provided will be greatly appreciated.
-----Original Message-----
From: McCloy, Russell [mailto:Russell.McCloy@B...]
Sent: Thursday, April 11, 2002 5:37 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
<script language=javascript>
function closeYourWin()
{
window.close()
}
</script>
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Friday, 12 April 2002 7:04 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
javascript is the best way.
Sorry about my smartass comment before, I couldn't resist!
-----Original Message-----
From: Ronnie Tripplett [mailto:rtripplett@a...]
Sent: Thursday, April 11, 2002 9:47 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
Thanks.
I take it that there is no other way!
-----Original Message-----
From: Peter [mailto:petemail@r...]
Sent: Wednesday, April 10, 2002 10:36 PM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
just click on the button with the x on it, located in the top-right corner.
;-)
-----Original Message-----
Is there a way to close a browser window in an application using vs.net
without using javascript?
Message #10 by "Peter Lawrence" <peter.lawrence@p...> on Mon, 15 Apr 2002 16:53:57 +0100
|
|
Here's what I did to achieve the same effect - not elegant, but the issue is
that the server (using VB) is determining something which can only be run on
the browser (using Javascript).
In this approach the server code sets a page-level variable (i.e. outside
any subs / functions) to be a null string or a piece of Javascript to close
the window. That variable then gets included in the <body...> tag.
=====
Here's the variable...
Dim strCloseWin As String = ""
=====
This is the event handler which gets fired when the user presses my Close
Button...
Sub myButtonClick(objSender As Object, E As EventArgs)
' ... do the real work of handling the button here (none if you just want
to close the window) ...
If objSender.Id = "CloseButton" Then
' Include some javascript to close the window when the page reloads
strCloseWin = "onload='window.close()'"
End If
End Sub
=====
This is the HTML bit...
<body bgcolor="#DDEEFF" <%= strCloseWin %> >
Now when the page gets (re)loaded, the <body> tag has some Javascript to
tell it to close straight away.
Hope it helps
Peter Lawrence
----- Original Message -----
From: "Ronnie Tripplett" <rtripplett@a...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Monday, April 15, 2002 4:31 PM
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
> Here's the code for both the vb as well as the .aspx. It seems that the
vb
> code doesn't recognize the "closeYourWin()" function call because vs.net
> complains that closeYourWin is not declared. I would rather this page
close
> automatically after its done with the storedproc rather than relying on
the
> user to press a close window button. Thanks for looking into this issue
and
> providing help.....
>
Message #11 by Ronnie Tripplett <rtripplett@a...> on Tue, 16 Apr 2002 09:08:40 -0500
|
|
A bit of trickery, but Yes, it worked and saved the day!
Thanks a bunch to all contributing to this success!
-----Original Message-----
From: Peter Lawrence [mailto:peter.lawrence@p...]
Sent: Monday, April 15, 2002 10:54 AM
To: aspx_beginners
Subject: [aspx_beginners] RE: Closing a window without using Javascript
Here's what I did to achieve the same effect - not elegant, but the issue is
that the server (using VB) is determining something which can only be run on
the browser (using Javascript).
In this approach the server code sets a page-level variable (i.e. outside
any subs / functions) to be a null string or a piece of Javascript to close
the window. That variable then gets included in the <body...> tag.
=====
Here's the variable...
Dim strCloseWin As String = ""
=====
This is the event handler which gets fired when the user presses my Close
Button...
Sub myButtonClick(objSender As Object, E As EventArgs)
' ... do the real work of handling the button here (none if you just want
to close the window) ...
If objSender.Id = "CloseButton" Then
' Include some javascript to close the window when the page reloads
strCloseWin = "onload='window.close()'"
End If
End Sub
=====
This is the HTML bit...
<body bgcolor="#DDEEFF" <%= strCloseWin %> >
Now when the page gets (re)loaded, the <body> tag has some Javascript to
tell it to close straight away.
Hope it helps
Peter Lawrence
----- Original Message -----
From: "Ronnie Tripplett" <rtripplett@a...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Monday, April 15, 2002 4:31 PM
Subject: [aspx_beginners] RE: Closing a window without using Javascrip t
> Here's the code for both the vb as well as the .aspx. It seems that the
vb
> code doesn't recognize the "closeYourWin()" function call because vs.net
> complains that closeYourWin is not declared. I would rather this page
close
> automatically after its done with the storedproc rather than relying on
the
> user to press a close window button. Thanks for looking into this issue
and
> providing help.....
>
|
|
 |