473,889 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

closing browser window from server code

DM
Is there any way, using a server control, to execute a routine (say, add
record to database) and then close the browser window. I'm having a
difficult time doing this using a master\detail model where dialog apsx page
is opened when datagrid item on master page is clicked. Would like to be
able to have detail open in the html dialog where user can edit record, then
click save button to save changes to database, call opener routine to
refresh master data grid, and close the page.

This seems like it must be a pretty common data managment scenario, so I
would assume that there would be a simple means of achieving this.

Have tried using RegisterclientS criptBlock to write a window.close within
the page that is opened as a dialog , but it won't close the window.
Nov 18 '05 #1
4 5089

"DM" <da************ *******@cfl.rr. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Is there any way, using a server control, to execute a routine (say, add
record to database) and then close the browser window. I'm having a
difficult time doing this using a master\detail model where dialog apsx page is opened when datagrid item on master page is clicked. Would like to be
able to have detail open in the html dialog where user can edit record, then click save button to save changes to database, call opener routine to
refresh master data grid, and close the page.

This seems like it must be a pretty common data managment scenario, so I
would assume that there would be a simple means of achieving this.

Have tried using RegisterclientS criptBlock to write a window.close within
the page that is opened as a dialog , but it won't close the window.


Any error messages?
How are you writing this script? You need <script> tags around it!
There is also a "RegisterStartu pScript" that you might use for this.

Hans Kesting
Nov 18 '05 #2
DM
After database udpate routine I call the following function:

Private Sub ReloadParent()

Dim strScript As String = "<script language='javas cript'>" & vbCrLf

strScript += " window.close(); " & vbCrLf

strScript += "</script>" & vbCrLf

RegisterClientS criptBlock("Clo seScript", strScript)

End Sub

I'm not getting any error messages, it just doesn't do anything.

"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message
news:u7******** ******@TK2MSFTN GP11.phx.gbl...

"DM" <da************ *******@cfl.rr. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Is there any way, using a server control, to execute a routine (say, add
record to database) and then close the browser window. I'm having a
difficult time doing this using a master\detail model where dialog apsx

page
is opened when datagrid item on master page is clicked. Would like to be able to have detail open in the html dialog where user can edit record,

then
click save button to save changes to database, call opener routine to
refresh master data grid, and close the page.

This seems like it must be a pretty common data managment scenario, so I
would assume that there would be a simple means of achieving this.

Have tried using RegisterclientS criptBlock to write a window.close within the page that is opened as a dialog , but it won't close the window.


Any error messages?
How are you writing this script? You need <script> tags around it!
There is also a "RegisterStartu pScript" that you might use for this.

Hans Kesting

Nov 18 '05 #3
DM
It seems as though the window is closing, but is being re-opened when the
dialog attempts to call the opener's routine to refresh the master data grid
because the opener's startup script used to open the dialog when a datagrid
item is selected is being run again. Is there any way to unregister a
script block?
"DM" <da************ *******@cfl.rr. com> wrote in message
news:ez******** ******@TK2MSFTN GP12.phx.gbl...
After database udpate routine I call the following function:

Private Sub ReloadParent()

Dim strScript As String = "<script language='javas cript'>" & vbCrLf

strScript += " window.close(); " & vbCrLf

strScript += "</script>" & vbCrLf

RegisterClientS criptBlock("Clo seScript", strScript)

End Sub

I'm not getting any error messages, it just doesn't do anything.

"Hans Kesting" <ne***********@ spamgourmet.com > wrote in message
news:u7******** ******@TK2MSFTN GP11.phx.gbl...

"DM" <da************ *******@cfl.rr. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Is there any way, using a server control, to execute a routine (say, add record to database) and then close the browser window. I'm having a
difficult time doing this using a master\detail model where dialog apsx
page
is opened when datagrid item on master page is clicked. Would like to be able to have detail open in the html dialog where user can edit
record,
then
click save button to save changes to database, call opener routine to
refresh master data grid, and close the page.

This seems like it must be a pretty common data managment scenario, so

I would assume that there would be a simple means of achieving this.

Have tried using RegisterclientS criptBlock to write a window.close

within the page that is opened as a dialog , but it won't close the window.


Any error messages?
How are you writing this script? You need <script> tags around it!
There is also a "RegisterStartu pScript" that you might use for this.

Hans Kesting


Nov 18 '05 #4
see
http://www.lostinet.com/en/lwsamplec...controlhelper/
http://www.lostinet.com/en/lwsamplec...dialogelement/
for my sample

--
http://www.lostinet.com/
Lostinet.Web Controls&Compon ents help you to build better Asp.Net
CustomerControl &UserControl&Ap plication.
ControlHelper&H elperElement for MessageBox&Dial og
ComboBox,ComboC alendar,SmartIf rame
Remote Asp.Net Execution

"DM" <da************ *******@cfl.rr. com> дÈëÓʼþ
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Is there any way, using a server control, to execute a routine (say, add
record to database) and then close the browser window. I'm having a
difficult time doing this using a master\detail model where dialog apsx page is opened when datagrid item on master page is clicked. Would like to be
able to have detail open in the html dialog where user can edit record, then click save button to save changes to database, call opener routine to
refresh master data grid, and close the page.

This seems like it must be a pretty common data managment scenario, so I
would assume that there would be a simple means of achieving this.

Have tried using RegisterclientS criptBlock to write a window.close within
the page that is opened as a dialog , but it won't close the window.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3454
by: hawkon | last post by:
Hi all, I have an important question to ask about how to trap events when the user close the browser window. I'm a ASP programmer and I have s MSSQL database with a user table where I'm able to track if the user is logged in or not. However this is not easy to track if the user close the browserwindow without using the logout button. I have tried putting in code in Session_onend, but it doesn't seem to run if the browser is closed. Eg....
2
8900
by: Derek | last post by:
Hello: I want to capture the event when a browser is closing, to give to the user the posibility of close or no this browser. When the browser is closing, this show a confirm window with two buttons: Accept and Cancel. When press the Accept button, the browser is closing, and when press the Cancel button, the browser isn´t closing. I have tried with the event onunload, but this closes first the browser, and
4
8446
by: Max Dupenois | last post by:
I've seen numerous articles with similair (similar sp?) titles to this in my search.. unfortunately none of them seem to contain what i want, (or if they do i need someone to point out my stupidity for me :p ) Anyway I have a file dialog box being opened using Response.AddHeader "Content-Disposition", "attachment;filename=""" & displayName & """" Response.ContentType = "application/binary"
4
2065
by: bbass | last post by:
thanks to all that replyied to my previous post with the following code in question: <a href="merc.htm" target="_new_merc" onfocusout=window.close class="left_link"> i understand that the people don't like the idea of closing the browser window because it's annoyance to the user
1
2263
by: Chirag Malvi | last post by:
hello all, I am developing the web application using ASP.net and VS.2003 IDE. here is the situation which i want to implement. 1) User is browsing some webform. I want to trap this event. this i am doing with Session_Onstart. 2) Now when user is exiting i.e. closing the browser window i want to trap this event and perform some operation. I tried using Session_OnEnd event,but
5
4492
by: Uma Muthu | last post by:
Hello Everyone, How can I capture the event of closing the IE browser from within an ASP.NET web application? TIA, Uma
7
1892
by: Rich | last post by:
I have the following script on all pop up windows, would like to have this work on all newer browsers if possible. Right now it only works on MSIE & Opera. Not sure why. Any suggestions are appreciated. Not concerned with the print part yet. TIA Rich <SCRIPT language="jscript"> function CloseWindow() { self.close(); }
7
4418
by: Santel | last post by:
Hi, I would like to do some server side actions while closing the browser window. I tried with Page_Unload event, but it triggers while loading the page itself. Anyone please tell me is there any event that triggers on closing the page?
1
10571
by: karthik juneni | last post by:
Hi all, Iam trying to capture windows closing event (i.e) when the user clicks on the "X" button i want to capture that event and want to update some values in the database.I tried two methods but iam getting problems with the two methods. First,one i tried with function Unload()
0
9962
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9810
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,...
1
10889
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,...
0
10442
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9609
agi2029
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...
0
7150
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6029
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4647
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
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.