Leave page prompt on postback

2 posts, 0 answers
  1. Charles
    Charles avatar
    1 posts
    Member since:
    Aug 2013

    Posted 22 Aug 2013 Link to this post

    I have noticed that every time that a post-back is triggered with RadControls, I receive an 'Are  you sure you want to leave this page?' prompt in Firefox.  So far I have tested it with the RadListBox and the RadTabStrip/RadMultiPage controls. 

    Is there a way to stop this prompt from displaying every time I click a control?

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

    Posted 23 Aug 2013 Link to this post

    Hi Charles,

    Please try the following JavaScript.

    JavaScript:
    <script type="text/javascript">
        window.onbeforeunload = function () {
            saveFormData();
            return null;
        }
        function saveFormData() {
            console.log('saved');
        }
    </script>

    Thanks,
    Shinu.
Back to Top