using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;

public partial class _Default : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
    
        RadGrid1.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
        RadGrid1.ItemCreated += RadGrid1_ItemCreated;
    }

    void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        GridFilteringItem filteringItem = e.Item as GridFilteringItem;
        if (filteringItem != null)
        {
            TextBox tb = filteringItem["ID"].Controls[0] as TextBox;
            TextBox tb1 = filteringItem["Item"].Controls[0] as TextBox;
            RadDatePicker picker = filteringItem["Date"].Controls[0] as RadDatePicker;
            picker.DateInput.Label = "Filter by Date";

            Label l = new Label();
            l.Text = "Filter by ID";
            l.AssociatedControlID = tb.ID;

            Label l1 = new Label();
            l1.Text = "Filter by Item";
            l1.AssociatedControlID = tb1.ID;

            filteringItem["ID"].Controls.AddAt(0,l);
            filteringItem["Item"].Controls.AddAt(0, l1);
        }
    }
    void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        DataTable table = new DataTable();
        table.Columns.Add("ID");
        table.Columns.Add("Item");
        table.Columns.Add("Date", typeof(DateTime));
        for (int i = 1; i < 800; i++)
        {
            table.Rows.Add(i, "Item", DateTime.Now.AddDays(i));
        }
        RadGrid1.DataSource = table;
    }
 
}
