I am using Telerik Contorl Q3 2009 version 2009.03.1103.20.
I am getting problmes while loading Rad combobox on item requested event.
Though i have written code for Items.clear() it is not working.
When i debug the application it shows Items.count to 0 but in UI it is not clearing that. You can see the attached screenshot
Also code which i had written
ASPX code
<telerik:RadComboBox Skin="Default" EnableVirtualScrolling="false" EnableEmbeddedSkins="true" ID="RadComboBox_Test"
runat="server" EnableLoadOnDemand="true" Height="300px" DropDownWidth="800px"
Width="400px" ItemRequestTimeout="500" HighlightTemplatedItems="true" AutoPostBack="true"
ShowToggleImage="false" onitemsrequested="RadComboBox_Test_ItemsRequested">
<ItemTemplate>
<table style="width: 800px; text-align: left;">
<tr>
<td style="width: 300px;" align="left">
<%
# DataBinder.Eval(Container.DataItem, "author")%>
</td>
<td style="width: 300px;" align="left">
<%
# DataBinder.Eval(Container.DataItem, "title")%>
</td>
<td style="width: 200px;" align="left">
<%
# DataBinder.Eval(Container.DataItem, "price")%>
</td>
</tr>
</table>
</ItemTemplate>
<HeaderTemplate>
<table style="width: 800px; text-align: left;">
<tr>
<td style="width: 300px;" align="left">
Author
</td>
<td style="width: 300px;" align="left">
Title
</td>
<td style="width: 200px;" align="left">
Price
</td>
</tr>
</table>
</HeaderTemplate>
</telerik:RadComboBox>
ASPX.CS file code
protected void RadComboBox_Test_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
{
try
{
string contactName = e.Text;
if (contactName.Length < 3)
return;
DataSet dataSet = new DataSet();
dataSet.ReadXml(Server.MapPath(
"~/TestXML2.xml"));
RadComboBox_Test.Items.Clear();
if (dataSet != null)
{
if (dataSet.Tables.Count > 0)
{
DataView dv = new DataView();
if (dataSet.Tables[0].Rows.Count == 0)
{
DataRow dataRow = dataSet.Tables[0].NewRow();
dataRow[
"author"] = "No Contacts found";
dataRow[
"title"] = "No Contacts found";
dataRow[
"price"] = "No Contacts found";
dataSet.Tables[0].Rows.Add(dataRow);
dv =
new DataView(dataSet.Tables[0]);
}
else
{
dv =
new DataView(dataSet.Tables[0]);
dv.Sort =
"author, title ASC";
dv.RowFilter =
"author like '" + contactName + "%'";
}
RadComboBox_Test.DataValueField =
"id";
RadComboBox_Test.DataTextField =
"title";
RadComboBox_Test.ClearSelection();
RadComboBox_Test.Items.Clear();
RadComboBox_Test.DataSource = dv;
RadComboBox_Test.DataBind();
}
}
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
I am using script manager in master page and updatepanel in aspx page.
Please help me ASAP.
Regards
Raj