Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Disabling the close button of a window..

Author  Topic 

blob
Starting Member

16 Posts

Posted - 2006-03-31 : 07:48:49
Hi,

Can anybody plz help me out with the javascript or asp.net code to disable the close button of a
window..ie..I should not give the user the provision to close his/her window.
How can i do this..

Any suggestions are greatly appreciated.
Thanks in advance

Regards
blob

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-31 : 09:35:34
not really...
see what options window.open() gives you.


Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2006-03-31 : 16:08:11
Well, theres no way that I know of to totally disable it, but you can possibly warn a user when they try to do that.
lookup window.onbeforeunload()

Michael

<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>

Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights.
Go to Top of Page

blob
Starting Member

16 Posts

Posted - 2006-04-01 : 00:55:38
Hi MichaelP,

Thank you for your suggestion on window.onbeforeunload()..

I need to submit the page with contents to the server when the user clicks the close window in IE by mistake..Any ideas on how to perform this please???..

Thanks in advance..
Regards
blob
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2006-04-02 : 23:01:28
OnBeforeUnload should allow you to do something like that. In the event handler for OnBeforeUnload do a myform.submit()

Michael

<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>

Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-03 : 05:39:53
i don't know how practical is that...
can you do any validation of inputs?
if you close it and do a form.submit() can you still do alert()?
haven't played with that...

Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2006-04-03 : 13:25:54
I think you should be able to do validation, alerts, etc inside of that OnBeforeUnload. If you find an error and need to prompt for it, you should be able to return false; and cancel the "close."

Just try it out and see what happens.

Michael

<Yoda>Use the Search page you must. Find the answer you will. Cursors, path to the Dark Side they are. Avoid them, you must. Use Order By NewID() to get a random record you will.</Yoda>

Opinions expressed in this post are not necessarily those of TeleVox Software, inc. All information is provided "AS IS" with no warranties and confers no rights.
Go to Top of Page
   

- Advertisement -