472,358 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 software developers and data experts.

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 RegisterclientScriptBlock 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 4975

"DM" <da*******************@cfl.rr.com> wrote in message
news:%2****************@tk2msftngp13.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 RegisterclientScriptBlock 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 "RegisterStartupScript" 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='javascript'>" & vbCrLf

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

strScript += "</script>" & vbCrLf

RegisterClientScriptBlock("CloseScript", 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**************@TK2MSFTNGP11.phx.gbl...

"DM" <da*******************@cfl.rr.com> wrote in message
news:%2****************@tk2msftngp13.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 RegisterclientScriptBlock 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 "RegisterStartupScript" 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**************@TK2MSFTNGP12.phx.gbl...
After database udpate routine I call the following function:

Private Sub ReloadParent()

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

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

strScript += "</script>" & vbCrLf

RegisterClientScriptBlock("CloseScript", 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**************@TK2MSFTNGP11.phx.gbl...

"DM" <da*******************@cfl.rr.com> wrote in message
news:%2****************@tk2msftngp13.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 RegisterclientScriptBlock 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 "RegisterStartupScript" 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&Components help you to build better Asp.Net
CustomerControl&UserControl&Application.
ControlHelper&HelperElement for MessageBox&Dialog
ComboBox,ComboCalendar,SmartIframe
Remote Asp.Net Execution

"DM" <da*******************@cfl.rr.com> дʼ
news:%2****************@tk2msftngp13.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 RegisterclientScriptBlock 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
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...
2
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...
4
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...
4
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...
1
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....
5
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
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...
7
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...
1
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.