items duplication at the time of scrolling

8 posts, 0 answers
  1. shankar mohan
    shankar mohan avatar
    20 posts
    Member since:
    Mar 2010

    Posted 29 Mar 2010 Link to this post

    am using radcombobox with itemrequested event,while dragging the scroll bar of radcombox the item which is present in the combox is repeated

    <EditItemTemplate> 
                    <telerik:RadComboBox ID="Programme"  AutoPostBack="true" runat="server" EnableLoadOnDemand="true" Height="200px" OnSelectedIndexChanged="Programme_SelectedIndexChanged" OnItemsRequested="Programme_ItemsRequested" Width="150"/> 
                    </EditItemTemplate> 
     
     
     
    protected void Programme_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) 
            {                       
                RadComboBox drp = (RadComboBox)sender; 
                e.Context.Clear(); 
                Dv.Table = DropDownDs.Tables[0]; 
                Dv.RowFilter = "Type in ('" + drp.ID + "') and Text like '" + e.Text + "*' "; 
                drp.Items.Clear(); 
                drp.DataTextField = "Text"
                drp.DataValueField = "Value"
                drp.DataSource = Dv
                drp.DataBind(); 
                 
            } 

    i ve tried with the following properties too
    but it doesnt work
    ShowMoreResultsBox="true"  EnableVirtualScrolling="true"
    or
    ShowMoreResultsBox="false"  EnableVirtualScrolling="false"
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 29 Mar 2010 Link to this post

    Hi shankar mohan,

    When the ShowMoreResults and/or EnableVirtualScrolling properties are set to true the RadComboBox *appends* the new Items loaded via clicking on the 'show more' label/scrolling to the existing set of Items.

    The server-side Clear() method does not work in the ItemsRequested event handler because there are actually no Items on the server at this moment.

    Regards,
    Simon
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. shankar mohan
    shankar mohan avatar
    20 posts
    Member since:
    Mar 2010

    Posted 29 Mar 2010 Link to this post

    hi Simon

    actually am not using those properties,
    i just checked by setting true and false for those properties to avoid duplication,
    but the duplication is coming in both the scenarios while scrolling


  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 29 Mar 2010 Link to this post

    Hello shankar mohan,

    In case the EnableVirtualScrolling property is false there should not be a scroll in the drop down with a few Items.

    Please see the attached page as a reference. The RadComboBox in it has both (ShoreMoreResults/EnableVirtualScrolling) properties set to false by default and does not have a scroll.

    What can be different in your case?

    Best wishes,
    Simon
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. shankar mohan
    shankar mohan avatar
    20 posts
    Member since:
    Mar 2010

    Posted 29 Mar 2010 Link to this post

    hi simon
    i tried in the way which yu ve mentioned in the previous post

    still i couldnt find what mistake i ve done on that
    <%@ Page Language="C#" MasterPageFile="~/NPI.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" Title="Untitled Page" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
     
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"
     
    <%--<script type="text/javascript" language="javascript" src="js/Validation.js"></script> 
    <input  type="text" id="txt1" visible="false" onblur="stringadd('txt2')" /> 
    <input  type="text" id="txt2" visible="false"onblur="stringadd('txt3')" /> 
    <input  type="text" id="txt3" visible="false" />--%> 
    <telerik:RadComboBox ID="rad1" AutoPostBack="true" ShowMoreResultsBox="false" EnableVirtualScrolling="false" runat="server" EnableLoadOnDemand="true" Height="200px" Width="150" /> 
    </asp:Content> 
    public partial class WebForm1 : System.Web.UI.Page 
        {                 
            protected void Page_Load(object sender, EventArgs e) 
            {             
             rad1.ItemsRequested += new Telerik.Web.UI.RadComboBoxItemsRequestedEventHandler(Programme_ItemsRequested);            
            } 
            void Programme_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e) 
            { 
                for (int i = 0; i < 3; i++) 
                rad1.Items.Add(new Telerik.Web.UI.RadComboBoxItem("item" + i));            
            } 
     
        } 


  6. shankar mohan
    shankar mohan avatar
    20 posts
    Member since:
    Mar 2010

    Posted 29 Mar 2010 Link to this post

    hi Simon

    both the properties doesnt help me to disable the scroll bars{ (ShowMoreResults/EnableVirtualScrolling)}
    i ve used endoffset & endofitems properties in server side and its working fine now
    n i dont know what exactly the below code does but it works fine
    anyways
    thank q simon


    protected void Programme_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e) 
            {                                   
                RadComboBox drp = (RadComboBox)sender;             
                Dv.Table = DropDownDs.Tables[0]; 
                Dv.RowFilter = "Type in ('" + drp.ID + "') and Text like '" + e.Text + "*' ";             
                ///changes for duplication & scroll 
                int itemsPerRequest = 5
                int itemOffset = e.NumberOfItems; 
                int endOffset = itemOffset + itemsPerRequest; 
                if (endOffset > Dv.Count) 
                { 
                    endOffset = Dv.Count; 
                } 
                if (endOffset == Dv.Count) 
                { 
                    e.EndOfItems = true
                } 
                else 
                { 
                    e.EndOfItems = false
                } 
                drp.DataTextField = "Text"
                drp.DataValueField = "Value"
                drp.DataSource = Dv
                drp.DataBind(); 
     

  7. Justin
    Justin avatar
    16 posts
    Member since:
    Oct 2007

    Posted 02 Jun 2011 Link to this post

    Is there any way around this duplcation behavior?  I've got a load-on-demand combobox that uses the "show more results" text area (ShowMoreResultsBox = true) for indicating to the user that they need to type something to filter the results... As they type, the list is repopulated with more refined results.

    However, when they click the down arrow to request more items, it appends to the list rather than replace it even though I call this.RadComboBox.Items.Clear() and rebind the datasource.

    Any suggestions?  I'm using Q3 2010 .NET 2.0 (v2010.3.1215.20)
  8. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 03 Jun 2011 Link to this post

    Hello Justin,

    This is normal - the 'show more results' functionality appends newly added items by design. Please consider using another way of letting users know that they can filter the combobox by typing. For instance, use a label or a tooltip.

    I hope this helps.

    Regards,
    Simon
    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.

Back to Top