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

Combo loadon demand problem

2 Answers 88 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
vairam
Top achievements
Rank 1
vairam asked on 02 Mar 2009, 12:27 PM
Hi

I am loading the combo ondemand .If i type 'A' in the combo's text box  the first 10 results are coming in the drop down list with scroll bar.In the bottom its showing 1-10 out of 55 items.But if i scroll down the drop down list still first 10 records only displaying it's not going to the next 10.Because the first item has selected automatically when i type somting in the combo.If the result is more than 10 records and then scroll down nothing will be happened.what i needs to do?
Regards
Vairam

2 Answers, 1 is accepted

Sort by
0
kmccusker
Top achievements
Rank 1
answered on 02 Mar 2009, 09:04 PM
Hi Vairam,

Could you provide a code sample demonstrating this issue?
0
Nathan J Pledger
Top achievements
Rank 2
answered on 04 Mar 2009, 04:20 PM
Hi Vairam,

I've just had this problem too. I was being a bit dumb, though, but I still don;t understand what was happening.

I had the Filter property set to "Contains" and was using LoadOnDemand. However, my backend was already filtering the results, which were coming back correctly. When they were populated in the ItemsRequested event, they all went in, but didn't appear on the combo box - just the counts, as you say. I realised my error, and set Filter to "None", it now works faster and the correct number of results is displayed in the drop down portion.

Even though I was accientally Filtering the text twice (with the same expression), I would have still expected the items to be displayed, but maybe that's something Telerik could explain.

My code, btw, if it should help:

    <telerik:RadComboBox ID="radSearchComboBox" runat="server"  
                            Skin="Vista"  
                            Height="150" 
                            AccessibilityMode="true"  
                            AllowCustomText="true"  
                            Filter="None" 
                            EmptyMessage="Search"  
                            MarkFirstMatch="false" 
                            EnableItemCaching="false" 
                            Sort="Ascending" 
                            ItemRequestTimeout="250" 
                            SortCaseSensitive="false"                        
                            EnableTextSelection="true"  
                            EnableVirtualScrolling="true" 
                            EnableLoadOnDemand="true" 
                            LoadingMessage="...Searching ..."  
                            ShowDropDownOnTextboxClick="false"  
                            ShowMoreResultsBox="true"  
                            ShowWhileLoading="true"   
                            DropDownWidth="300" 
                            OnClientItemsRequesting="radSearchComboBox_OnClientItemsRequesting"  />                                                      
                        </telerik:RadComboBox> 

void _radSearchComboBox_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) 
        { 
            DateTime startTimestamp = DateTime.Now; 
 
            RadComboBox radComboBox = (RadComboBox)o; 
            int itemsPerRequest = 20; 
            int itemOffset = e.NumberOfItems; 
            int endOffset = itemOffset + itemsPerRequest; 
 
            using ( .... ) 
            { 
                 
// code removed for clarity and IP 
 
                ISearchResult[] searchResults=searchHandler.Search(); 
                if (searchResults.Length == 0) 
                { 
                    e.Message = "No matching items"
                } 
                else 
                { 
                    if (endOffset > searchResults.Length) endOffset = searchResults.Length; 
                    for (int i = itemOffset; i < endOffset; i++) 
                    { 
                        ISearchResult searchResult = searchResults[i]; 
                         
                            RadComboBoxItem item = new RadComboBoxItem(searchResult.Caption); 
                            radComboBox.Items.Add(item); 
                         
                    } 
 
                    DateTime endTimeStamp = DateTime.Now; 
 
                    e.Message = "Showing <strong>1</strong>-<strong>" + endOffset.ToString("#,##0") + "</strong> out of " + searchResults.Length.ToString("#,##0") + " results ("+endTimeStamp.Subtract(startTimestamp).Milliseconds.ToString("#,##0")+"ms)"
                } 
            } 
 
 
        } 

Tags
ComboBox
Asked by
vairam
Top achievements
Rank 1
Answers by
kmccusker
Top achievements
Rank 1
Nathan J Pledger
Top achievements
Rank 2
Share this question
or