This is a migrated thread and some comments may be shown as answers.

OnDemand Duplicates Items on virtual scrolling

9 Answers 161 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 07 Feb 2011, 06:44 PM
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:

<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.

9 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 10 Feb 2011, 08:52 AM
Hi Jeff,

Could you please tell us which version of the controls exactly you're using? Thanks

Kind regards,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Jeff
Top achievements
Rank 1
answered on 10 Feb 2011, 02:08 PM
2010.2.929.35
0
Yana
Telerik team
answered on 10 Feb 2011, 05:34 PM
Hello Jeff,

Is it possible for you to upgrade to a newer version?  This seems as a  bug which is already fixed.

Best wishes,
Yana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Jeff
Top achievements
Rank 1
answered on 10 Feb 2011, 06:54 PM
Upgraded to latest version: 2010.3.1215.35

Still failed. 

Used Upgrade Wizard to Download latest 2010.3.1317.35

Still fails.



0
Kalina
Telerik team
answered on 10 Feb 2011, 09:49 PM
Hello Jeff,

EnableVirtualScrolling property let you load the RadComboBox items in portions.
Please find a detailed explanation of this property and a sample implementation at this help article.

Kind regards,
Kalina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Jeff
Top achievements
Rank 1
answered on 14 Feb 2011, 10:59 PM
I have read that article, the problem is I cannot use the code as displayed in the article because I am using a Multi-Column Combo unless you can provide an example to use the RadComboBox1.Items.Add method with a templated 3 column combo like this:

<telerik:RadComboBox ID="radcmbProduct" runat="server" Width="250px" Height="200px" AllowCustomText="false"
                            EmptyMessage="Select a Product" EnableLoadOnDemand="True" ShowMoreResultsBox="true" DropDownWidth="525px"
                            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>
0
Kalina
Telerik team
answered on 18 Feb 2011, 09:41 PM
Hello Jeff,

I prepared for you an example with the RadComboBox definition pasted here and the Northwind database.
Please note that I have used the RadComboBox Attributes collection – you can find more details about this collection here.
Additionally in order to instantiate the item template I databinded every item explicitly after adding it to RadComboBox items collection.

I hope this helps.

Regards,
Kalina
the Telerik team
0
Jeff
Top achievements
Rank 1
answered on 21 Feb 2011, 03:33 PM
Thank you!  This is now working for me.
0
joseph
Top achievements
Rank 1
answered on 22 Sep 2016, 09:17 PM

The key for me was to make sure that the following code line was in place

            if (e.NumberOfItems == searchResults.TotalRecords)
            {
                e.EndOfItems = true;
                return;
            }

Tags
ComboBox
Asked by
Jeff
Top achievements
Rank 1
Answers by
Yana
Telerik team
Jeff
Top achievements
Rank 1
Kalina
Telerik team
joseph
Top achievements
Rank 1
Share this question
or