asp.net Ajax 异步刷新时:前进后退按钮可用。

 <asp:ScriptManager ID="ScriptManager1" runat="server" EnableHistory="True" 
        EnableSecureHistoryState="False">
    </asp:ScriptManager>     
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Wizard ID="Wizard1" runat="server"  ActiveStepIndex="0" onactivestepchanged="Wizard1_ActiveStepChanged">
                <WizardSteps>
                    <asp:WizardStep runat="server" title="Step 1">
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    </asp:WizardStep>
                    <asp:WizardStep runat="server" title="Step 2">
                        Step 2</asp:WizardStep>
                    <asp:WizardStep runat="server" Title="Step 3">
                        Step 3</asp:WizardStep>
                    <asp:WizardStep runat="server" Title="Step 4">
                        Step 4</asp:WizardStep>
                    <asp:WizardStep runat="server" Title="Step 5">
                        Step 5</asp:WizardStep>
                </WizardSteps>
            </asp:Wizard>
        </ContentTemplate>
    </asp:UpdatePanel>

CS:Code

    protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
        {
            if (this.ScriptManager1.IsInAsyncPostBack &&
                !this.ScriptManager1.IsNavigating)
            {
                this.ScriptManager1.AddHistoryPoint(
                    "index", this.Wizard1.ActiveStepIndex.ToString(),
                    "Step " + this.Wizard1.ActiveStepIndex);
            }
        }

        protected void ScriptManager1_Navigate(object sender, HistoryEventArgs e)
        {
            if (String.IsNullOrEmpty(e.State["index"]))
            {
                this.Wizard1.ActiveStepIndex = 0;
            }
            else
            {
                this.Wizard1.ActiveStepIndex = Int32.Parse(e.State["index"]);
            }

        }
原文地址:https://www.cnblogs.com/you000/p/2831596.html