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;
using System.Collections;


public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


    }

    protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        DataTable dt = new DataTable();
        DataRow dr;
        int rowsNum = 30;
        string[][] colsInfo = {
		new string[] { "PeopleID", "number" },
		new string[] { "Assignee", "string" },
		new string[] { "JurisdictionCount", "number" },
		new string[] { "State", "string" },
		new string[] { "OpenItemsCountPrior", "number" },
        new string[] { "OpenItemsCountLastMonth", "number" },
        new string[] { "OpenItemsCountCurrent", "number" },
        new string[] { "TotalRemainingItems", "number" },
        new string[] { "CompleteCount", "number" },
        new string[] { "PercentComplete", "string" },
        //new string[] { "Custom10", "string" },
        //new string[] { "Custom11", "string" },
        //new string[] { "Custom12", "string" },
        //new string[] { "Custom13", "string" },
        //new string[] { "Custom14", "string" },
        //new string[] { "Custom15", "string" },
        //new string[] { "Custom16", "string" },
        //new string[] { "Custom17", "string" },
        //new string[] { "Custom18", "string" },
        //new string[] { "Custom19", "string" },
        //new string[] { "Custom20", "string" },
        //new string[] { "Custom21", "string" },
        //new string[] { "Custom22", "string" },
        //new string[] { "Custom23", "string" },
        //new string[] { "Custom24", "string" },
        //new string[] { "Custom25", "string" },
        //new string[] { "Custom26", "string" },
        //new string[] { "Custom27", "string" },
        //new string[] { "Custom28", "string" },
        //new string[] { "Custom29", "string" },
        //new string[] { "Custom30", "string" },
		new string[] { "OrderDate", "date" },
		new string[] { "DueDate", "date" },
		new string[] { "ShipDate", "date" },
		new string[] { "CreditCardApprovalCode", "number" },
		new string[] { "SubTotal", "number" },
		new string[] { "TaxAmt", "number" },
		new string[] { "Freight", "number" },
		new string[] { "Status", "string" },
		new string[] { "PurchaseOrderNumber", "number" },
		new string[] { "ModifiedDate", "date" }


	};

        for (int i = 0; i < colsInfo.Length; i++)
        {
            switch (colsInfo[i][1])
            {
                case "string":
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(String)));
                    break;
                case "number":
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(Int32)));
                    break;
                case "date":
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(DateTime)));
                    break;
                case "bool":
                    dt.Columns.Add(new DataColumn(colsInfo[i][0], typeof(Boolean)));
                    break;
                default:
                    break;
            }
        }

        for (int j = 1; j <= rowsNum; j++)
        {
            dr = dt.NewRow();

            for (int k = 0; k < colsInfo.Length; k++)
            {
                switch (colsInfo[k][1])
                {
                    case "string":
                        dr[colsInfo[k][0]] = String.Format("{0} Row{1}", colsInfo[k][0], j);
                        break;
                    case "number":
                        dr[colsInfo[k][0]] = j;
                        break;
                    case "date":
                        dr[colsInfo[k][0]] = DateTime.Now;
                        break;
                    case "bool":
                        dr[colsInfo[k][0]] = j % 2 == 1 ? true : false;
                        break;
                    default:
                        break;
                }
            }
            dt.Rows.Add(dr);
        }

        (sender as RadGrid).DataSource = dt;
    }
}