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 Default4 : System.Web.UI.Page
{
    protected void custValItemID_ServerValidate(object sender, ServerValidateEventArgs e)
    {
        TextBox txt = ((sender as CustomValidator).NamingContainer as GridEditableItem)["ID"].FindControl("itemID") as TextBox;
        int id = 0;
        if (int.TryParse(txt.Text, out id))
        {
            if (id > 100 && id < 1000)
            {
                e.IsValid = true;
            }
            else
            {
                e.IsValid = false;
            }
        }
        else
        {
            e.IsValid = false;
        }
    }
    protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        DataTable table = new DataTable();
        table.Columns.Add("ID");
        for (int i = 1; i < 4; i++)
        {
            table.Rows.Add(100 + i);
        }
        RadGrid1.DataSource = table;
    }
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
        Label1.Text = "fired command: <b>" + e.CommandName + "</b>";
    }
}
