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

combo box load on demand show nearby results

1 Answer 35 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Phillip
Top achievements
Rank 1
Phillip asked on 19 Dec 2011, 07:53 PM
How do I show the nearby results when typing a search?

If I have a list of 1, 2, 3, 4, 5 in that order in the combo box.  If I type 3 in the box it only shows me 3 as an option, but I would like it to select 3 and but show 1, 2 above it and 4, 5 below it.  This will help me because my list is about 1000 items long.  After I select the item and the page posts back showin my results the item selected is showing in the list, but I need to click there and change to different item in the drop down.  Right now I have to delete what is in the list by selecting and delete and then it shows all the items.  I would like to just be able to drop down and scroll to the next item. 

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 20 Dec 2011, 02:51 PM
Hello Phillip,

The desired functionality is not supported by the RadComboBox. Alternatively you could use the following approach:
<telerik:RadComboBox ID="RadComboBox1" runat="server" Filter="StartsWith" AutoPostBack="true" OnClientDropDownOpening="OnClientDropDownOpening">
           <Items>
               <telerik:RadComboBoxItem Text="1" runat="server" />
               <telerik:RadComboBoxItem Text="2" runat="server" />
               <telerik:RadComboBoxItem Text="3" runat="server" />
               <telerik:RadComboBoxItem Text="4" runat="server" />
               <telerik:RadComboBoxItem Text="5" runat="server" />
               <telerik:RadComboBoxItem Text="6" runat="server" />
               <telerik:RadComboBoxItem Text="7" runat="server" />
           </Items>
       </telerik:RadComboBox>
<script type="text/javascript">
 
          function OnClientDropDownOpening(sender, args) {
 
              if (sender.get_text().length > 0) {
 
                  sender.findItemByText(sender.get_text()).highlight();
                  sender.set_text("");
              }
          }
      </script>

With the above implementation when you open the drop-down of the combobox, the selected item will be highlighted then the text from the input will be cleared which will cause all records to be shown, so you could choose a new item.

Regards,
Dimitar Terziev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
Phillip
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or