469,573 Members | 1,678 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

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 4863

"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Derek | last post: by
1 post views Thread by Chirag Malvi | last post: by
5 posts views Thread by Uma Muthu | last post: by
7 posts views Thread by Rich | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.