using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Data.OleDb;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void RadComboBox1_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
    {
        SqlConnection connection =
                    new SqlConnection(ConfigurationManager.ConnectionStrings["TelerikConnectionString"].ConnectionString);
        
        SqlCommand selectCommand =
            new SqlCommand(@"	SELECT ID, ProductName, Price FROM Products
								WHERE LOWER(ProductName) LIKE '" + e.Text + "%'", connection);

        SqlDataAdapter adapter = new SqlDataAdapter(selectCommand);
        DataTable products = new DataTable();
        adapter.Fill(products);

        RadComboBox1.DataTextField = "ProductName";
        RadComboBox1.DataValueField = "ID";
        RadComboBox1.DataSource = products;
        RadComboBox1.DataBind();
    }

    protected void RadComboBox1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
    {
        DataRowView row = e.Item.DataItem as DataRowView;
        e.Item.Attributes["Name"] = row["ProductName"].ToString();
        e.Item.Attributes["ProductID"] = row["ID"].ToString();
        e.Item.Attributes["Price"] = row["Price"].ToString();
    }
}