Dynamic AutoComplete on text editing

Thread is closed for posting
2 posts, 0 answers
  1. Kenneth Gangsto
    Kenneth Gangsto avatar
    3 posts
    Member since:
    Feb 2004

    Posted 29 Jan 2008 Link to this post

    We want to provide our users with AutoCompletetion in a ComboBox. The problem is that the data source is containing alot of items, so we need to limit the suggestions based on what the user is writing.

    So if the user enters Ab, we do a search in our database for entries starting with Ab and want to display those in the AutoComplete suggestor.

    Here is our initial try to solve this:

    private void radComboBox1_TextChanged(object sender, EventArgs e)

        foreach (string s in Accounts.Current.FindPartial(radComboBox1.Text))
            radComboBox1.Items.Add(new RadComboBoxItem(s));

    This seems to work ok as long as you keep typing, but once you start using arrow keys to select an item in the dropdown, we get an exception:

    Index was out of range. Must be non-negative and less than the size of the collection.
    (This happens in Telerik code inside radComboBox1.Items.Clear())

    We then tried to use the KeyPress event instead, but this didn't help us, as the ComboBox text property isn't updated at this point, so we cannot do a proper search string.

    Any idea how we can solve this problem?
  2. Georgi
    Georgi avatar
    212 posts

    Posted 30 Jan 2008 Link to this post

    Hi Kenneth,

    I have replied you in your support ticket and here is the text of the reply:

    RadComboBox has been designed to behave much like the standard MS ComboBox and the auto-complete behavior is disabled when DropDownStyle is set to DropDownList. Instead, there is in effect a specific for DropDownList auto-complete behavior, which however has no visual presentation (i.e. when the user types, the typed text does not appear in the textbox). We intend to implement the full set of autocomplete settings for DropDownList mode in the near future. Meanwhile there are different workarounds, which have already been discussed here: http://www.telerik.com/community/forums/thread/b311D-bbchhc.aspx

    If you have any additional questions, please write us again.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top