using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        radGrid1.ClientSettings.Scrolling.UseStaticHeaders = true;
        radGrid1.ClientSettings.Scrolling.AllowScroll = true;
        radGrid1.ClientSettings.Scrolling.SaveScrollPosition = true;
    }

    protected void Unnamed_Click(object sender, EventArgs e)
    {
        radGrid1.ClientSettings.Scrolling.UseStaticHeaders = false;
        radGrid1.ClientSettings.Scrolling.AllowScroll = false;
        radGrid1.ClientSettings.Scrolling.SaveScrollPosition = false;
        radGrid1.Rebind();

        ScriptManager.RegisterStartupScript(this, typeof(Page), "myscript", "function pageLoad(){PrintRadGrid(); $find('radGrid1').get_masterTableView().fireCommand('RetainPrevState','') }", true);
    }
    
    protected void radGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "RetainPrevState")
        {
            radGrid1.ClientSettings.Scrolling.UseStaticHeaders = true;
            radGrid1.ClientSettings.Scrolling.AllowScroll = true;
            radGrid1.ClientSettings.Scrolling.SaveScrollPosition = true;
            radGrid1.Rebind();
        }
    }
}