Hi,
I have a form with Submit and cancel button. When Cancel button is clicked I
want to close the browser window. Here is my sample form. To make things
simple I have removed the submit button. When I click on the cancel button,
the window doesn’t close. Can someone tell me what mistake I am making here?
Thanks for your help,
Joe
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s)
Response.Write( "<script>self.c lose();<\/script>")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" Runat="server" Text="Button"
OnClick="Button 1_Click" />
</div>
</form>
</body>
</html> 6 1384
You had a typo in your Response.Write line.
It should be this:
Response.Write( "<script>self.c lose();</script>")
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:E3******** *************** ***********@mic rosoft.com... Hi,
I have a form with Submit and cancel button. When Cancel button is clicked I want to close the browser window. Here is my sample form. To make things simple I have removed the submit button. When I click on the cancel button, the window doesn't close. Can someone tell me what mistake I am making here? Thanks for your help,
Joe
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s) Response.Write( "<script>self.c lose();<\/script>") End Sub </script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitl ed Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" Runat="server" Text="Button" OnClick="Button 1_Click" />
</div> </form> </body> </html>
Hi Steve,
If I use what you suggested -
Response.Write( "<script>self.c lose();</script>") then I get an Compilation
error saying: String constants must end with a double quote.
with line highlighted
Response.Write( "<script>self.c lose();</script>")
This error goes away when I use
Response.Write( "<script>self.c lose();<\/script>")
Notice the escape sequence "\". Not I don't get the error but the window
doesn't close.
Joe
"Steve C. Orr [MVP, MCSD]" wrote: You had a typo in your Response.Write line. It should be this: Response.Write( "<script>self.c lose();</script>")
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message news:E3******** *************** ***********@mic rosoft.com... Hi,
I have a form with Submit and cancel button. When Cancel button is clicked I want to close the browser window. Here is my sample form. To make things simple I have removed the submit button. When I click on the cancel button, the window doesn't close. Can someone tell me what mistake I am making here? Thanks for your help,
Joe
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Sub Button1_Click(B yVal sender As Object, ByVal e As System.EventArg s) Response.Write( "<script>self.c lose();<\/script>") End Sub </script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitl ed Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" Runat="server" Text="Button" OnClick="Button 1_Click" />
</div> </form> </body> </html>
Have you tried window.close?
--
I hope this helps,
Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message
news:07******** *************** ***********@mic rosoft.com... Hi Steve,
If I use what you suggested - Response.Write( "<script>self.c lose();</script>") then I get an Compilation error saying: String constants must end with a double quote. with line highlighted Response.Write( "<script>self.c lose();</script>")
This error goes away when I use Response.Write( "<script>self.c lose();<\/script>")
Notice the escape sequence "\". Not I don't get the error but the window doesn't close.
Joe
"Steve C. Orr [MVP, MCSD]" wrote:
You had a typo in your Response.Write line. It should be this: Response.Write( "<script>self.c lose();</script>")
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message news:E3******** *************** ***********@mic rosoft.com... > Hi, > > I have a form with Submit and cancel button. When Cancel button is > clicked > I > want to close the browser window. Here is my sample form. To make > things > simple I have removed the submit button. When I click on the cancel > button, > the window doesn't close. Can someone tell me what mistake I am making > here? > Thanks for your help, > > Joe > > <%@ Page Language="VB" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> > > <script runat="server"> > > Sub Button1_Click(B yVal sender As Object, ByVal e As > System.EventArg s) > Response.Write( "<script>self.c lose();<\/script>") > End Sub > </script> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title>Untitl ed Page</title> > </head> > <body> > <form id="form1" runat="server"> > <div> > <asp:Button ID="Button1" Runat="server" Text="Button" > OnClick="Button 1_Click" /> > > </div> > </form> > </body> > </html> >
Yup. Tried wind.close but same thing happens.
"Steve C. Orr [MVP, MCSD]" wrote: Have you tried window.close?
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message news:07******** *************** ***********@mic rosoft.com... Hi Steve,
If I use what you suggested - Response.Write( "<script>self.c lose();</script>") then I get an Compilation error saying: String constants must end with a double quote. with line highlighted Response.Write( "<script>self.c lose();</script>")
This error goes away when I use Response.Write( "<script>self.c lose();<\/script>")
Notice the escape sequence "\". Not I don't get the error but the window doesn't close.
Joe
"Steve C. Orr [MVP, MCSD]" wrote:
You had a typo in your Response.Write line. It should be this: Response.Write( "<script>self.c lose();</script>")
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message news:E3******** *************** ***********@mic rosoft.com... > Hi, > > I have a form with Submit and cancel button. When Cancel button is > clicked > I > want to close the browser window. Here is my sample form. To make > things > simple I have removed the submit button. When I click on the cancel > button, > the window doesn't close. Can someone tell me what mistake I am making > here? > Thanks for your help, > > Joe > > <%@ Page Language="VB" %> > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> > > <script runat="server"> > > Sub Button1_Click(B yVal sender As Object, ByVal e As > System.EventArg s) > Response.Write( "<script>self.c lose();<\/script>") > End Sub > </script> > > <html xmlns="http://www.w3.org/1999/xhtml" > > <head runat="server"> > <title>Untitl ed Page</title> > </head> > <body> > <form id="form1" runat="server"> > <div> > <asp:Button ID="Button1" Runat="server" Text="Button" > OnClick="Button 1_Click" /> > > </div> > </form> > </body> > </html> >
I'm not sure whats up but I use the same technique written a little diff. and
it always works.
Response.write "<script language=javasc ript>window.clo se()</script>"
Never had any trouble. I don't use the parenths on the write function. mabye
try that.
Good luck.
"Joe" wrote: Yup. Tried wind.close but same thing happens.
"Steve C. Orr [MVP, MCSD]" wrote:
Have you tried window.close?
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message news:07******** *************** ***********@mic rosoft.com... Hi Steve,
If I use what you suggested - Response.Write( "<script>self.c lose();</script>") then I get an Compilation error saying: String constants must end with a double quote. with line highlighted Response.Write( "<script>self.c lose();</script>")
This error goes away when I use Response.Write( "<script>self.c lose();<\/script>")
Notice the escape sequence "\". Not I don't get the error but the window doesn't close.
Joe
"Steve C. Orr [MVP, MCSD]" wrote:
> You had a typo in your Response.Write line. > It should be this: > Response.Write( "<script>self.c lose();</script>") > > -- > I hope this helps, > Steve C. Orr, MCSD, MVP > http://SteveOrr.net > > > "Joe" <Jo*@discussion s.microsoft.com > wrote in message > news:E3******** *************** ***********@mic rosoft.com... > > Hi, > > > > I have a form with Submit and cancel button. When Cancel button is > > clicked > > I > > want to close the browser window. Here is my sample form. To make > > things > > simple I have removed the submit button. When I click on the cancel > > button, > > the window doesn't close. Can someone tell me what mistake I am making > > here? > > Thanks for your help, > > > > Joe > > > > <%@ Page Language="VB" %> > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" > > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> > > > > <script runat="server"> > > > > Sub Button1_Click(B yVal sender As Object, ByVal e As > > System.EventArg s) > > Response.Write( "<script>self.c lose();<\/script>") > > End Sub > > </script> > > > > <html xmlns="http://www.w3.org/1999/xhtml" > > > <head runat="server"> > > <title>Untitl ed Page</title> > > </head> > > <body> > > <form id="form1" runat="server"> > > <div> > > <asp:Button ID="Button1" Runat="server" Text="Button" > > OnClick="Button 1_Click" /> > > > > </div> > > </form> > > </body> > > </html> > > > > >
falcon, I don't know how you are able to do witout paranthese because asp.net
should give you error.
Anyway when I tried this,
Response.Write( "<script language=javasc ript>window.clo se()<" & "/script>")
I didn't get any errors and the window was closed too. WoW.
Thanks everybody for your time and help.
Joe
"falcon" wrote: I'm not sure whats up but I use the same technique written a little diff. and it always works.
Response.write "<script language=javasc ript>window.clo se()</script>"
Never had any trouble. I don't use the parenths on the write function. mabye try that.
Good luck. "Joe" wrote:
Yup. Tried wind.close but same thing happens.
"Steve C. Orr [MVP, MCSD]" wrote:
Have you tried window.close?
-- I hope this helps, Steve C. Orr, MCSD, MVP http://SteveOrr.net
"Joe" <Jo*@discussion s.microsoft.com > wrote in message news:07******** *************** ***********@mic rosoft.com... > Hi Steve, > > If I use what you suggested - > Response.Write( "<script>self.c lose();</script>") then I get an Compilation > error saying: String constants must end with a double quote. > with line highlighted > Response.Write( "<script>self.c lose();</script>") > > This error goes away when I use > Response.Write( "<script>self.c lose();<\/script>") > > Notice the escape sequence "\". Not I don't get the error but the window > doesn't close. > > Joe > > > "Steve C. Orr [MVP, MCSD]" wrote: > >> You had a typo in your Response.Write line. >> It should be this: >> Response.Write( "<script>self.c lose();</script>") >> >> -- >> I hope this helps, >> Steve C. Orr, MCSD, MVP >> http://SteveOrr.net >> >> >> "Joe" <Jo*@discussion s.microsoft.com > wrote in message >> news:E3******** *************** ***********@mic rosoft.com... >> > Hi, >> > >> > I have a form with Submit and cancel button. When Cancel button is >> > clicked >> > I >> > want to close the browser window. Here is my sample form. To make >> > things >> > simple I have removed the submit button. When I click on the cancel >> > button, >> > the window doesn't close. Can someone tell me what mistake I am making >> > here? >> > Thanks for your help, >> > >> > Joe >> > >> > <%@ Page Language="VB" %> >> > >> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" >> > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> >> > >> > <script runat="server"> >> > >> > Sub Button1_Click(B yVal sender As Object, ByVal e As >> > System.EventArg s) >> > Response.Write( "<script>self.c lose();<\/script>") >> > End Sub >> > </script> >> > >> > <html xmlns="http://www.w3.org/1999/xhtml" > >> > <head runat="server"> >> > <title>Untitl ed Page</title> >> > </head> >> > <body> >> > <form id="form1" runat="server"> >> > <div> >> > <asp:Button ID="Button1" Runat="server" Text="Button" >> > OnClick="Button 1_Click" /> >> > >> > </div> >> > </form> >> > </body> >> > </html> >> > >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Wayne Wengert |
last post by:
Using the Code Window in VS.NET if I put the mouse cursor over a method such
as "Select" and right click I get a nice window defining that method. How do
I close that window when I am done reading it? There is no "Close" button I
can see?
--
------------------------------------
Wayne Wengert
wayne@wengert.org
|
by: Johnny Knoxville |
last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works
fine if you add the site to favourites the normal way, but I have some
JavaScript code on a couple of pages with a link, which when you click it
bookmarks the site (much easier). The favicon is never saved if the site
is bookmarked this way. Does anyone have any ideas how to fix this??
This is the code:
<script language="JavaScript">
|
by: serge calderara |
last post by:
Dear all,
I have an application which is suppose to start another executable process.
As soon as that process is running, I need to retrive its handle. The
problem of the particular process I am starting is that it has a welcome
window first which gets displayed and then the real windows after a while,in
other words it means that the process name is the same, but the handle I need
to retrive is the one from the final window and not the...
|
by: Tom Szabo |
last post by:
Is there an event when that triggers when the window is closing.... I am
talking about when the user clicks on the cross on the right top corner of
the window!!!
|
by: Ron L |
last post by:
I have an MDI application with a number of child windows. In each child
window I am catching the Closing event and having the child window decide if
it should set cancel to true. The intent here is to ensure that no child
window can close while it is in a state where user entered information can
be lost. I have just noticed that while the Closing event is caught if I
click the X on the child window, it is not caught if I click the X on...
| |
by: Jon |
last post by:
I am writing an MDI app that uses a document manager class
to keep track of opened child windows. I want the user to
be able to close a child window, but then re-open the
window from the "Window" menu if they want.
What happens to the child window after it is closed? Even
though my document manager maintains the instance of the
child and displays the name in the menu, when I try to use
the show() method or the activate() method on a...
|
by: Chris Bruce |
last post by:
In my application I need a way to distiguish between the following events:
1. When a user closes an MDI child window.
2. When the user closes the MDI parent window which subsequently closes
the MDI child window.
My application does certain logic when the user actually closes the MDI
child form by clicking the "X" in the upper right hand. My application,
however, should not execute this logic if the user closes the MDI parent. I...
|
by: Saradhi |
last post by:
Hi,
I wanted to stop the VS.NET Window from closing inside my C# AddIn.
I Know that OnBeginShutdown() funciton will be called whenever the user tries to close the VS.NET window.
I want to check some conditions and if those conditions doesnt meet, then I want to stop the VS.NET window from closing.
Anybody have any diea?
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
|
by: Tom |
last post by:
How is the best way to avoid validation when closing a
window? For instance, I have a Windows Forms window which
has a validation event for a text box. However, if one
enters invalid data in then and then attempts to close the
window (either via my custom 'Close' box or by clicking the
close 'X' in the upper right window corner), the validation
event still triggers and it tells the user that they have
invalid data. Which of course means...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |