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

Confirm Radwindow close

1 Answer 48 Views
Window
This is a migrated thread and some comments may be shown as answers.
JC
Top achievements
Rank 1
JC asked on 13 May 2013, 08:10 AM
Hi Telerik,

Using the standard browser dialog Is it possible to display a confirm dialog when closing the Radwindow?

Thanks,
JC

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 May 2013, 09:07 AM
Hi JC,

Please have a look at the following code I tried which works fine at my end.

ASPX:
<telerik:RadButton ID="RadButton1" runat="server" AutoPostBack="false" Text="Open RadWindow"
    OnClientClicked="OnClientClicked">
</telerik:RadButton>
<telerik:RadWindow ID="RadWindow1" runat="server" OnClientBeforeClose="OnClientBeforeClose">
    <ContentTemplate>
        <telerik:RadDatePicker ID="RadDatePicker1" runat="server">
        </telerik:RadDatePicker>
    </ContentTemplate>
</telerik:RadWindow>

JavaScript:
<script type="text/javascript">
    function OnClientClicked(sender, args) {
        var RadWindow1 = $find('<%=RadWindow1.ClientID %>');
        RadWindow1.show();
    }
    function OnClientBeforeClose(sender, args) {
        args.set_cancel(!confirm("Are you sure you want to close this window"));
    }
</script>

Thanks,
Shinu.
Tags
Window
Asked by
JC
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or