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

Prevent User from closing the radwindow

2 Answers 116 Views
Window
This is a migrated thread and some comments may be shown as answers.
anvesh amaravadi
Top achievements
Rank 1
anvesh amaravadi asked on 14 Sep 2010, 06:27 PM
Hi

I want to prevent a user closing the radwindow (which pops up by clicking on a row in a grid) without entering some data
I have tried onUnload and onBeforeUnload event but my telerik window runs those events after i close the window

Ex: If a click a row window pops up and then i close it and then If i try to open pop up by clicking on a different row then the onunload and onbeforeunload events are running

Do you have any idea how to prevent a user closing the window

by giving an alert or by disabling the close button on top (ofcourse we have customized close button on the page)

I have to allow user if he enters data or prevent him if doesn't enter
is there a way to do it for radwindow

2 Answers, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 15 Sep 2010, 05:42 PM
You should handle the RadWindow's OnClientBeforeClose event. The reason for your onUnload and onBeforeUnload events not being fired is because the RadWindow is just a container for an iFrame control, so it's technically just hiding itself and not closing the page, so those page events don't get raised until the control gets reloaded by the other row selection, thus causing your current situation.

So if you handle the RadWindow's OnClientBeforeClose you will be able to determine if the user made any changes and then alert them and prevent the window from closing.

I hope that helps.
0
anvesh amaravadi
Top achievements
Rank 1
answered on 16 Sep 2010, 12:47 AM
Thanks for your reply cori

I did, and it worked
thank you
Tags
Window
Asked by
anvesh amaravadi
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
anvesh amaravadi
Top achievements
Rank 1
Share this question
or