Hide\Disable The Loading... Text On ItemsRequested

4 posts, 0 answers
  1. Felix
    Felix avatar
    2 posts
    Member since:
    May 2012

    Posted 30 May 2012 Link to this post

    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

  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 30 May 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Felix
    Felix avatar
    2 posts
    Member since:
    May 2012

    Posted 30 May 2012 Link to this post

    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

  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 31 May 2012 Link to this post

    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.
Back to Top