ASP.NET Podcast

ASP.NET Podcast is geared towards the Microsoft .NET Framework and ASP.NET.
The podcast is run by Wally McClure, David Penton, and Paul Glavich.
Welcome to ASP.NET Podcast Sign in | Join | Help
in Search

ASP.NET Podcast

The ASP.NET Podcast features, technical talks, interviews, news, reviews, and Wallyisms. Wallace B. (Wally) McClure, David Penton, and Paul Glavich are your hosts. We talk about ASP.NET, AJAX, Performance, Databases, WCF, Silverlight, Cloud Computing, Windows Azure, and whatever else we decide to talk about.

ASP.NET Podcast Show #117 - Using the History Functionality with the ASP.NET AJAX UpdatePanel in .NET 3.5 Service Pack 1 Beta 1

Subscriptions & Downloads

Subscribe to everything.

Subscribe to WMV.

Subscribe to M4V for iPod.

Subscribe to MP3.

Download WMV.

Download M4V for iPod.

Download MP3.

Show Notes:


This is the UpdatePanel with EnableSecureHistoryState set to true


This is the UpdatePanel with EnableSecureHistoryState set to false.


Source Code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UpdatePanelHistory.aspx.cs" Inherits="UpdatePanelHistory" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">

<head runat="server">

    <title>UpdatePanel History Button</title>



    <form id="form1" runat="server">

    <asp:ScriptManager ID="scm" runat="server"





    <asp:Button ID="btnSubmit" runat="server" Text="Click Me!"

            onclick="btnSubmit_Click" />

    <asp:UpdatePanel ID="upl" runat="server" UpdateMode="Conditional">


        <asp:Label ID="lblTime" runat="server" />



        <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />









using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Collections.Specialized;

public partial class UpdatePanelHistory : System.Web.UI.Page


    protected void Page_Load(object sender, EventArgs e)





    protected void scm_Navigate(object sender, HistoryEventArgs he)


        NameValueCollection pageState = he.State;

        string dtS;

        if (pageState != null)


            dtS = pageState.Get("Time");

            if (!String.IsNullOrEmpty(dtS))


                lblTime.Text = dtS;




                lblTime.Text = String.Empty;






    protected void btnSubmit_Click(object sender, EventArgs e)


        string dtS = DateTime.Now.ToString();

        lblTime.Text = dtS;

        if ((scm.IsInAsyncPostBack == true) && (scm.IsNavigating != true))





    private void AddHistoryPoint(string HistoryPoint)


        NameValueCollection pageState = new NameValueCollection();

        pageState.Add("Time", HistoryPoint);

        scm.AddHistoryPoint(pageState, "Time:" + HistoryPoint);


Published Sunday, June 15, 2008 1:59 PM by admin
Anonymous comments are disabled

This Blog


Powered by Community Server, by Telligent Systems