using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Globalization;
using System.Drawing;

public partial class Default : System.Web.UI.Page 
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
        RadGrid1.ItemDataBound += new GridItemEventHandler(RadGrid1_ItemDataBound);
    }

    void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataBoundItem = e.Item as GridDataItem;
            if (int.Parse(dataBoundItem["numericField"].Text.ToString(), NumberStyles.AllowThousands) > 1000000)
            {
                dataBoundItem["Item"].BackColor = Color.Goldenrod;
                dataBoundItem["ID"].BackColor = Color.Goldenrod;
                dataBoundItem["Date"].BackColor = Color.Goldenrod;
                dataBoundItem["numericField"].BackColor = Color.Goldenrod;
                dataBoundItem["Item"].Font.Bold = true;
                dataBoundItem["ID"].Font.Bold = true;
                dataBoundItem["Date"].Font.Bold = true;
                dataBoundItem["numericField"].Font.Bold = true;


            }
            if (int.Parse(dataBoundItem["numericField"].Text.ToString(), NumberStyles.AllowThousands) > 10000000)
            {
                dataBoundItem["Item"].BackColor = Color.Firebrick;
                dataBoundItem["ID"].BackColor = Color.Firebrick;
                dataBoundItem["Date"].BackColor = Color.Firebrick;
                dataBoundItem["numericField"].BackColor = Color.Firebrick;
            }
        } 
    }

    void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        DataTable table = new DataTable();
        table.Columns.Add("ID");
        table.Columns.Add("Item");
        table.Columns.Add("Date", typeof(DateTime));
        table.Columns.Add("numericField");
        for (int i = 1; i < 10; i++)
        {
            table.Rows.Add(i, "Item" + i.ToString(), DateTime.Now.AddDays(i), "1001,000");
        }
        RadGrid1.DataSource = table;
    }
}
