OnDemand Duplicates Items on virtual scrolling

10 posts, 0 answers
  1. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 07 Feb 2011 Link to this post

    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.

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 Feb 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 10 Feb 2011 Link to this post

    2010.2.929.35
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 10 Feb 2011 Link to this post

    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.
  6. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 10 Feb 2011 Link to this post

    Upgraded to latest version: 2010.3.1215.35

    Still failed. 

    Used Upgrade Wizard to Download latest 2010.3.1317.35

    Still fails.



  7. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 10 Feb 2011 Link to this post

    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.
  8. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 14 Feb 2011 Link to this post

    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>
  9. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 18 Feb 2011 Link to this post

    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
  10. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 21 Feb 2011 Link to this post

    Thank you!  This is now working for me.
  11. joseph
    joseph avatar
    1 posts
    Member since:
    Sep 2016

    Posted 22 Sep in reply to Jeff Link to this post

    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;
                }

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017