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;

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

	protected void Page_Load(object sender, EventArgs e)
	{
		//System.Threading.Thread.Sleep(5000);
	}

	protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
	{
		DataTable dt = new DataTable();
		DataRow dr;
		int rowsNum = 130;
		string[][] colsInfo = {
		new string[] { "allergie", "string" },
		new string[] { "gene_numero", "number" },
		new string[] { "gral_numero", "number" },
		new string[] { "Category", "string" },
		new string[] { "Status", "boolean" },
		//new string[] { "Custom5", "string" },
        //new string[] { "Custom6", "string" },
        //new string[] { "Custom7", "string" },
        //new string[] { "Custom8", "string" },
        //new string[] { "Custom9", "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[] { "Start_Date", "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;
	}


}