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

Show dropdown on filter

2 Answers 106 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Gus Oakes
Top achievements
Rank 1
Gus Oakes asked on 07 Sep 2009, 04:17 PM
I am working on a web app in which we have several fields that are technically free-text, but we want the users to reuse values already in the database if possible to avoid retyping, typos, duplication, etc. For this, I am trying to use the combobox with a substring filter. The problem I am running into is this: I do not want the dropdown to appear when the user clicks in the textbox, but I do want it to appear when they type something and the list is being filtered. Kind of like the Google suggest, but without the server round-trip. The way the Infragistics combobox works with filtering is basically what I am looking for. Is there a way to get this done with the Telerik combobox? Or can I get what I am looking for with another control?

Another thing I want to be able to do with a combobox is to require that the user pick one of the items, but still have the filter "lookup" capability. So basically they would still be able to type in whatever they want, but maybe when tabbing off some client-side validation would kick in.

Or, more generally, what controls/solutions do you use for the following situations:

 - select from a small/medium list
 - select from a large list
 - select from a small/medium list with optional free-text
 - select from a large list with optional free-text
 - what if select is preferred over free-text?


Thanks to anyone for input.

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 09 Sep 2009, 11:39 AM
Hello Gus,

Please try it like this:

<telerik:RadComboBox ID="RadComboBox1" runat="server"  
                    Filter="Contains"  
                    AllowCustomText="true"  
                    ShowDropDownOnTextboxClick="false"  
                    OnClientKeyPressing="keyPressing"  
                    OnClientBlur="cllientBlur"
<Items> 
    <telerik:RadComboBoxItem Text="item 1" /> 
    <telerik:RadComboBoxItem Text="item 2" /> 
</Items> 
</telerik:RadComboBox> 

and the javascript methods:

<script type="text/javascript"
   function keyPressing(sender, args) { 
        if (sender.get_dropDownVisible() == false
            sender.showDropDown(); 
    } 
 
    function cllientBlur(sender, args) { 
        var item = sender.findItemByText(sender.get_text()); 
        if (item == null
            alert("Please select item from the list"); 
    } 
</script> 


Greetings,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gus Oakes
Top achievements
Rank 1
answered on 17 Sep 2009, 12:58 AM

That looks good! Thanks again.
Tags
ComboBox
Asked by
Gus Oakes
Top achievements
Rank 1
Answers by
Yana
Telerik team
Gus Oakes
Top achievements
Rank 1
Share this question
or