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

items duplication at the time of scrolling

7 Answers 122 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
shankar mohan
Top achievements
Rank 1
shankar mohan asked on 29 Mar 2010, 12:00 PM
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"

7 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 29 Mar 2010, 02:06 PM
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.
0
shankar mohan
Top achievements
Rank 1
answered on 29 Mar 2010, 02:20 PM
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


0
Simon
Telerik team
answered on 29 Mar 2010, 02:29 PM
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.
0
shankar mohan
Top achievements
Rank 1
answered on 29 Mar 2010, 03:05 PM
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));            
        } 
 
    } 


0
shankar mohan
Top achievements
Rank 1
answered on 29 Mar 2010, 04:06 PM
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(); 
 

0
Justin
Top achievements
Rank 2
answered on 02 Jun 2011, 07:20 PM
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)
0
Simon
Telerik team
answered on 03 Jun 2011, 03:03 PM
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.

Tags
ComboBox
Asked by
shankar mohan
Top achievements
Rank 1
Answers by
Simon
Telerik team
shankar mohan
Top achievements
Rank 1
Justin
Top achievements
Rank 2
Share this question
or