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
{
    protected void Page_Load(object sender, System.EventArgs e)
    {
        DefineGridStructure();
    }
    private void DefineGridStructure()
    {
        RadGrid grid = new RadGrid();
        grid.ID = "RadGrid1";
        grid.DataSourceID = "AccessDataSource1";
        grid.Skin = "Sunset";
        grid.Width = Unit.Percentage(100);
        grid.AllowPaging = true;
        grid.AllowCustomPaging = false;
        grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
        grid.AutoGenerateColumns = false;
        grid.MasterTableView.PageSize = 40;
        grid.GridLines = GridLines.None;
        grid.MasterTableView.Width = Unit.Percentage(100);
        grid.MasterTableView.DataKeyNames = new string[] { "CustomerID" };

        grid.ShowGroupPanel = false;
        grid.ClientSettings.AllowDragToGroup = false;

        grid.ClientSettings.AllowColumnsReorder = true;
        grid.MasterTableView.AllowSorting = true;
        grid.AllowMultiRowSelection = true;
    
        grid.Width = Unit.Percentage(100);  

        GridBoundColumn boundColumn = new GridBoundColumn();
        boundColumn.DataField = "CustomerID";
        boundColumn.HeaderText = "Customer ID";
        grid.MasterTableView.Columns.Add(boundColumn);
        boundColumn = new GridBoundColumn();
        boundColumn.DataField = "ContactName";
        boundColumn.HeaderText = "Contact Name";
        grid.MasterTableView.Columns.Add(boundColumn);

        // Add the grid to the placeholder
        this.PlaceHolder1.Controls.Add(grid);
    }
}