Hi all,
Here in the combobox i am getting problem with ItemsRequested event i am unable to get related data of which the word i had typed in the RadComboBox here is the code
protected void cmbPlatformName_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e){DataTable data = objTaskmanLib.GetData(e.Text); //GetData(e.Text);RadComboBoxItem item = new RadComboBoxItem();int itemOffset = e.NumberOfItems;int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);e.EndOfItems = endOffset == data.Rows.Count;for (int i = itemOffset; i < endOffset; i++){cmbPlatformName.Items.Add(new RadComboBoxItem(data.Rows[i]["Platform_Name"].ToString(), data.Rows[i]["Platform_Name"].ToString()));}e.Message = GetStatusMessage(endOffset, data.Rows.Count);}private string GetStatusMessage(int endOffset, int total){if (total <= 0)return "No matches";return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset, total);}
Here is the library code of getdata()
public DataTable GetData(string text)
{
DataTable data = new DataTable();
//data = null;
try
{
conn = new SqlConnection(connectionstring);
SqlDataAdapter adapter = new SqlDataAdapter("Select Platform_ID, Platform_Name from T26_Platform_Main where Record_Status='Active' and Platform_Name LIKE '" + text + "%'", connectionstring);
//adapter.SelectCommand.Parameters.AddWithValue("@text", text);
//SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from T26_Platform_Main WHERE Platform_Name LIKE @text + '%'",ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
adapter.Fill(data);
//return data;
}
catch (Exception excep)
{
Console.WriteLine(excep.Message);
}
return data;
}