By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,706 Members | 1,637 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,706 IT Pros & Developers. It's quick & easy.

closing browser window from server code

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a

"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

P: n/a
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

P: n/a
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

P: n/a
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.