[CLOSED] How to use the History control?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] How to use the History control?

    Hi,

    I'm trying to mimic the behavior of "blocking" the use of the browser "Back" button. When the user attempts to navigate backwards, a prompt should be presented and page location remain the same. The prompt should not fire when the page initially loads, which is the problem of the code sample below. It seems that the call to suspend events on the History control has no bearing on it so when the token is sent, the change event always fires. Please suggest how to fix it.

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" />
        <ext:ResourcePlaceHolder ID="ResourcePlaceHolder2" runat="server" Mode="Style" />
        <script type="text/javascript">
            var onDocumentReady = function () {
                History1.suspendEvents(false);
                History1.add("Main");
                History1.resumeEvents();
            };
    
            var blockBackButton = function () {
                History1.add("Main");
                Ext.Msg.alert("Alert", "Back button is disabled!");
            };
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server">
            <Listeners>
                <DocumentReady Fn="onDocumentReady" />
            </Listeners>
        </ext:ResourceManager>
        <form id="form1" runat="server">
            <ext:History ID="History1" runat="server">
                <Listeners>
                    <Change Fn="blockBackButton" />
                </Listeners>
            </ext:History>
        </form>
    </body>
    </html>
    Last edited by fabricio.murta; Apr 06, 2016 at 2:50 PM.

Similar Threads

  1. [CLOSED] History control is unavailable in DocumentReady handler
    By vadym.f in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 30, 2013, 4:39 PM
  2. [CLOSED] [2.0] History
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: May 30, 2012, 11:47 AM
  3. [CLOSED] Security Error when using History control in IE6
    By jthompson in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Feb 17, 2012, 6:16 AM
  4. [CLOSED] History Example
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 24, 2011, 1:56 AM
  5. History manager?
    By dbassett74 in forum 1.x Help
    Replies: 2
    Last Post: May 06, 2009, 10:28 PM

Tags for this Thread

Posting Permissions