I have a RadComboBox with multiple columns of text shown, I have not found a solution to the virtual scrolling duplicating all items in the combo.
Here is the code - aspx:
and here is the code behind:
So I need to find a way to prevent the items duplicating on scrolling, while maintaining the multiple column text capability. I have tried adding radcmbProduct.Items.Clear() prior to the DataBind() in the Items Requested method, however, this had no effect.
I have tried using the attributes as suggested in a previous post however, there were issues with that where the multi-column would only populate the first column.
I have not found a working solution.
Here is the code - aspx:
<
telerik:RadComboBox
ID
=
"radcmbProduct"
runat
=
"server"
Width
=
"400px"
Height
=
"200px"
AllowCustomText
=
"false"
EmptyMessage
=
"Select a Product"
EnableLoadOnDemand
=
"True"
ShowMoreResultsBox
=
"true"
DropDownWidth
=
"600px"
EnableVirtualScrolling
=
"true"
HighlightTemplatedItems
=
"true"
MarkFirstMatch
=
"true"
ItemsPerRequest
=
"60"
NoWrap
=
"true"
OnItemsRequested
=
"radcmbProduct_ItemsRequested"
OnItemDataBound
=
"radcmbProduct_ItemDataBound"
>
<
HeaderTemplate
>
<
ul
>
<
li
class
=
"col1"
>Title</
li
>
<
li
class
=
"col2"
>System</
li
>
<
li
class
=
"col3"
>Price</
li
>
</
ul
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
ul
>
<
li
class
=
"col1"
>
<%# DataBinder.Eval(Container.DataItem, "Title") %></
li
>
<
li
class
=
"col2"
>
<%# DataBinder.Eval(Container.DataItem, "GameSystemName")%></
li
>
<
li
class
=
"col3"
>
<%# DataBinder.Eval(Container.DataItem, "DisplayPrice")%></
li
>
</
ul
>
</
ItemTemplate
>
</
telerik:RadComboBox
>
and here is the code behind:
private DataSet GetProductDataSet(string productText)
{
string errorMsg = string.Empty;
DataSet DS = new DataSet();
Product.GetByName(FacilityID, productText, ref DS, ref errorMsg);
return DS;
}
protected void radcmbProduct_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{
DataSet data = GetProductDataSet(e.Text);
radcmbProduct.DataSource = data;
radcmbProduct.DataBind();
}
protected void radcmbProduct_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
{
e.Item.Text = ((DataRowView)e.Item.DataItem)["Title"].ToString() + " | " + ((DataRowView)e.Item.DataItem)["GameSystemName"].ToString() + " | " + ((DataRowView)e.Item.DataItem)["DisplayPrice"].ToString();
e.Item.Value = ((DataRowView)e.Item.DataItem)["ProductID"].ToString();
}
So I need to find a way to prevent the items duplicating on scrolling, while maintaining the multiple column text capability. I have tried adding radcmbProduct.Items.Clear() prior to the DataBind() in the Items Requested method, however, this had no effect.
I have tried using the attributes as suggested in a previous post however, there were issues with that where the multi-column would only populate the first column.
I have not found a working solution.