using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Data;
using Telerik.Web.UI;

public partial class Grid_Pager : System.Web.UI.Page
{

    private void DefineGridStructure()
    {
        RadGrid RadGrid1 = new RadGrid();
        RadGrid1.ID = "RadGrid1";

        RadGrid1.DataSourceID = "SqlDataSource1";

        RadGrid1.Width = Unit.Percentage(100);
        RadGrid1.PageSize = 5;
        RadGrid1.AllowPaging = true;
        RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
        RadGrid1.AutoGenerateColumns = false;
        RadGrid1.AllowSorting = true;
        RadGrid1.ShowGroupPanel = true;
        RadGrid1.ShowStatusBar = true;
        RadGrid1.ClientSettings.AllowDragToGroup = true;

        RadGrid1.MasterTableView.PageSize = 15;
        RadGrid1.MasterTableView.DataKeyNames = new string[] { "CustomerID" };

        GridBoundColumn boundColumn;
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "CustomerID";
        boundColumn.HeaderText = "CustomerID";
        RadGrid1.MasterTableView.Columns.Add(boundColumn);

        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "ContactName";
        boundColumn.HeaderText = "Contact Name";
        RadGrid1.MasterTableView.Columns.Add(boundColumn);

        this.placeHolder.Controls.Add(RadGrid1);
    }

    protected void Page_Init(object sender, System.EventArgs e)
    {
        DefineGridStructure();
    }


    protected void Page_Load(object sender, System.EventArgs e)
    {
        RadGrid grid = (RadGrid)placeHolder.FindControl("RadGrid1");
        radAjaxManager.AjaxSettings.AddAjaxSetting(grid, grid, radAjaxLoadingPanel);
    }

}
