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

Hide\Disable The Loading... Text On ItemsRequested

3 Answers 146 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Felix
Top achievements
Rank 1
Felix asked on 30 May 2012, 01:13 PM

Hello,

I have a radcombobox which uses load on demand.

On ItemsRequested I check to see how many characters have been typed into the combobox so that it doesn't populate the combobox untill the user has entered at least two characters:

If e.Text.Length > 1 Then
......
End If

The trouble is, even when a user only types one character into the combobox it says 'Loading...',  it should only display the loading text when two or more characters have been entered into the combobox, beacuse until two characters have been entered nothing has actually been loaded.

Does anyone have an idea how i can accomplish this?

Thanks for your advice,

Felix

3 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 30 May 2012, 01:35 PM
Hello Felix,

This has become a built-in feature in the RadComboBox. If you set the property MinFilterLength="2", it will only start loading results when a minimum of two characters have been entered.

If you are using a version of the RadControls where this property doesn't exist, you can refer to this help article:

http://www.telerik.com/help/aspnet-ajax/combobox-onclientitemsrequesting.html

I hope that helps.
0
Felix
Top achievements
Rank 1
answered on 30 May 2012, 01:52 PM
Hi Kevin,

Thanks thats really helpful.

If the user types in two charaters, it now does a search correctly.

The only problem I have now is that If the user then deletes the letters they have entered, it keeps the values in the dropdown that have been filtered, because the load on demand is no longer getting hit below the length of the filter length.

Is there a quick way of clearing down the dropdown values if the user types in less that the minfilterlength? Will I need to user jQuery to acheive this?

Does that make sense?

Thanks for your help,

Felix

0
Princy
Top achievements
Rank 2
answered on 31 May 2012, 02:15 PM
Hi Felix,

Try the following code snippet to clear the dropdown values if the user types less than the MinFilterLength.

JS:
<script type="text/javascript" >
function OnClientItemsRequesting(sender, eventArgs)
    {
        if (sender.get_text().length < 2)
        {
            eventArgs.set_cancel(true);
            sender.clearItems();
        }
    }
</script>

Thanks,
Princy.
Tags
ComboBox
Asked by
Felix
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Felix
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or