Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How do I use a <asp:button> to close a window

Reply
Thread Tools

How do I use a <asp:button> to close a window

 
 
=?Utf-8?B?RWQgQ2hpdQ==?=
Guest
Posts: n/a
 
      10-28-2004
Hi,

I would like to add a <asp:button> to a webform. When user click on this
button, the page will connect to SQL server and update tables, then the
browser window will be closed.

I know how to connect to SQL server and update tables but I don't know how
to close browser window after that. The SQL server part is on the server
side, closing window is on client side.

TIA
 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      10-28-2004
Ed Chiu wrote:
> I would like to add a <asp:button> to a webform. When user click on this
> button, the page will connect to SQL server and update tables, then the
> browser window will be closed.
>
> I know how to connect to SQL server and update tables but I don't know how
> to close browser window after that. The SQL server part is on the server
> side, closing window is on client side.


Ed, in your Button's Click event handler, you'll have to inject some
client-side JavaScript (namely, self.close(). You can accomplish this
using the Page.RegisterClientScriptBlock() method. I discuss this
method, closing windows, and how to achieve other common client-side
techniques in ASP.NET, in this article of mine:

Working with Client-Side Script
http://tinyurl.com/3w474

Happy Programming!

--

Scott Mitchell

http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 
Reply With Quote
 
 
 
 
Saravana
Guest
Posts: n/a
 
      10-29-2004
after you fetch the details from sql server. Write the following line

Page.RegisterStartupscript("name","<script language="javascript">
window.close() </script>")



--
Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com


"Ed Chiu" <> wrote in message
news7308E6B-1318-49CE-98A9-...
> Hi,
>
> I would like to add a <asp:button> to a webform. When user click on this
> button, the page will connect to SQL server and update tables, then the
> browser window will be closed.
>
> I know how to connect to SQL server and update tables but I don't know how
> to close browser window after that. The SQL server part is on the server
> side, closing window is on client side.
>
> TIA



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close a TCP socket? (TCPSocket#close doesn't close it) Iñaki Baz Castillo Ruby 7 01-12-2010 01:32 PM
close all child windows when close the main window jrefactors@hotmail.com HTML 6 08-07-2008 09:10 AM
close current window using window.close() Shang Wenbin Javascript 10 09-02-2005 12:16 AM
close all child windows when close the main window jrefactors@hotmail.com Javascript 3 01-16-2005 10:06 PM
Self.close() window without the dialog close?Yes/NO Walter Beierdonck Javascript 1 04-30-2004 02:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57