warn radwindow close.

2 posts, 0 answers
  1. Damian
    Damian avatar
    21 posts
    Member since:
    Mar 2013

    Posted 29 Aug 2013 Link to this post


    I am opening a radwindow on a radbutton click which opens an edit form to the user. There are save and cancel buttons inside the window. I wrote the code to warn the user if he attempt to close the radwindow without save. I want to do the same if the user  press the back button and try to go back to previous page. Any suggestions?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Aug 2013 Link to this post

    Hi Damian,

    Please try the following code to display a browser alert on pressing the back button.

    <telerik:RadButton ID="RadButton1" runat="server" Text="Open Edit Form">
    <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" Behaviors="None" Width="400px"
        Height="400px" OpenerElementID="RadButton1" OnClientShow="OnClientShow">
            <div style="padding: 15px 10px 10px 25px;">
                <telerik:RadTextBox ID="RadTextBox1" runat="server" Label="No :">
                <br />
                <telerik:RadTextBox ID="RadTextBox2" runat="server" Label="Name :">
                <br />
                <telerik:RadButton ID="RadButton2" runat="server" Text="Save" OnClientClicked="OnClientClicked"
                <telerik:RadButton ID="RadButton3" runat="server" Text="Cancel">

    <script type="text/javascript">
        function OnClientShow(sender, args) {
            window.onbeforeunload = function () { return "Unsaved data will be lost."; };
        function OnClientClicked(sender, args) {
            window.onbeforeunload = null;

  3. DevCraft R3 2016 release webinar banner
Back to Top