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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Scott Mitchell [MVP] (mitchell_at_4guysfromrolla.com)
Date: 10/28/04


Date: Thu, 28 Oct 2004 16:52:24 GMT

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
     mitchell@4guysfromrolla.com
     http://www.4GuysFromRolla.com
		
* When you think ASP.NET, think 4GuysFromRolla.com!


Relevant Pages

  • How to programmatically set <title>?
    ... to open PDFs stored in a SQL Server 2000 table in a new browser window. ... The HTML of the ASPX page is ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How do I use a <asp:button> to close a window
    ... after you fetch the details from sql server. ... www.ExtremeExperts.com "Ed Chiu" wrote in message ... When user click on this> button, the page will connect to SQL server and update tables, then the ... > I know how to connect to SQL server and update tables but I don't know how> to close browser window after that. ...
    (microsoft.public.dotnet.framework.aspnet)
  • How do I use a <asp:button> to close a window
    ... I would like to add a to a webform. ... I know how to connect to SQL server and update tables but I don't know how ... to close browser window after that. ... TIA ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Best practice to transfer data from Excel file to SQL Server 2000
    ... What I am working on is a web-based client-side application. ... don't have the permission to use the Import/Export Utility in SQL Server ... >> I am trying write a web application using ASP.Net to load an Excel file ... >> client site and save all the data in the file to a table in SQL Server ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: click button
    ... I want to ensure that some server scripts will ... run before another browser window opens... ... How to open a new browser window. ... so you either have to embed a client-side script ...
    (microsoft.public.dotnet.general)