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)
	{

	}

	protected void RadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
	{
		DataTable dt = new DataTable();
		DataRow dr;
		int rowsNum = 30;
		string[][] colsInfo = {
		new string[] { "Custom1", "string" },
		new string[] { "Custom2", "string" },
		new string[] { "Custom3", "string" },
		new string[] { "Custom4", "string" },
		new string[] { "Custom5", "string" },
	};

		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;
	}

}