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

public partial class Default : System.Web.UI.Page
{
    RadGrid RadGrid1 = new RadGrid();
    private void DefineGridStructure()
    {     
        RadGrid1.DataSourceID = "AccessDataSource1";
        RadGrid1.MasterTableView.DataKeyNames = new string[] { "CustomerID" };
        RadGrid1.Skin = "Default";    
        RadGrid1.Width = Unit.Pixel(500);
        RadGrid1.PageSize = 10;
        RadGrid1.AllowPaging = true;
        RadGrid1.AllowSorting = true;
        RadGrid1.AutoGenerateColumns = false;
        RadGrid1.MasterTableView.PageSize = 15;
        RadGrid1.MasterTableView.TableLayout = GridTableLayout.Fixed;
        //Add columns
        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);
        RadGrid1.MasterTableView.HierarchyLoadMode= GridChildLoadMode.ServerOnDemand;     
        this.PlaceHolder1.Controls.Add(RadGrid1);
    }
    protected void Page_Load(object source, System.EventArgs e)
    {
        DefineGridStructure();
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadGrid1, RadGrid1, LoadingPanel1);
    }

}