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

Dynamic AutoComplete on text editing

1 Answer 194 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kenneth Gangsto
Top achievements
Rank 1
Kenneth Gangsto asked on 29 Jan 2008, 10:35 AM
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)
{
    radComboBox1.Items.Clear();

    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?

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 30 Jan 2008, 03:29 PM
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.

Greetings,
Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Kenneth Gangsto
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or