This is a migrated thread and some comments may be shown as answers.

Stop RadWindow from closing

3 Answers 130 Views
Window
This is a migrated thread and some comments may be shown as answers.
Doug Rutledge
Top achievements
Rank 1
Doug Rutledge asked on 21 Jul 2008, 03:46 PM
In my application, I'm using the onbeforeunload event to check for unsaved changes by the user.  This works great for regular forms.  I tried the same approach with pages used as RadWindows, and it kind of works.  If I change a value on the radwindow and click the "x" to close it without saving, the RadWindow closes and then the prompt to save shows up.  Obviously this is too late since the RadWindow is now gone.  I thought about trying to use the OnClientClose event on the RadWindow, but the documentation states that it is called after the window is closed.  Is there a way to to run some javascript when the "x" on the RadWindow is clicked so that I have a chance to stop it and ask the user to save changes?

Doug

3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 21 Jul 2008, 03:51 PM
Hello Doug,

I believe that the following forum thread will be of help:
http://www.telerik.com/community/forums/thread/b311D-bebdmb.aspx




Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Doug Rutledge
Top achievements
Rank 1
answered on 21 Jul 2008, 04:09 PM
That looks like it will work, but I'm not quite sure how to call the old_close method if I determine that it is ok to close the window.
0
Accepted
Georgi Tunev
Telerik team
answered on 22 Jul 2008, 02:14 PM
Hello Doug,

Here is how to do this:

Telerik.Web.UI.RadWindow.prototype.old_close = Telerik.Web.UI.RadWindow.prototype.close;   
   
Telerik.Web.UI.RadWindow.prototype.close = function(e)   
{   
     //Override close   
     //call the old close method when you need to close the window 
     this.old_close(e); 


I hope this helps.


Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Doug Rutledge
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Doug Rutledge
Top achievements
Rank 1
Share this question
or