Confirm Radwindow close

2 posts, 0 answers
  1. JC
    JC avatar
    30 posts
    Member since:
    Feb 2013

    Posted 13 May 2013 Link to this post

    Hi Telerik,

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

    Thanks,
    JC
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 May 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top