using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class Default : System.Web.UI.Page
{
    protected void RadGrid1_PageIndexChanged(object sender, GridPageChangedEventArgs e)
    {
        string currentIndex = RadGrid1.MasterTableView.CurrentPageIndex.ToString();
        ScriptManager.GetCurrent(this).AddHistoryPoint(pageKey, e.NewPageIndex.ToString());
    }

    private static String pageKey = "p";

    public void OnNavigateHistory(object sender, HistoryEventArgs e)
    {
        string pageIndex;
        if (e.State[pageKey] != null)
            pageIndex = e.State[pageKey];
        else
            pageIndex = "0";

        RadGrid1.MasterTableView.CurrentPageIndex = Int32.Parse(pageIndex);
        RadGrid1.Rebind();
    }
}
