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

Custom auto-complete logic

3 Answers 129 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.
Ben
Top achievements
Rank 1
Ben asked on 10 Mar 2009, 10:33 PM
Hi,

I have a RadComboBox which contains a list of objects. These objects have both a *name* and a *code*. The text value for each combo item is *<name> (<code>)* and the object is stored in the item value.

I have AutoCompleteMode = SuggestAppend and DropDownStyle = DropDown which gives me the necessary auto-complete logic for a user typing in something matching *<name> (<code>)*.

However I want the user to be able to type in something and the combo attempt to match on either the name OR code. Is this possible by sub-classing the combo and overriding some event?

For example, say we have an object with name = "Test Object" and code = "TST01". If the user types "T" we would get a match on this item, and if they typed "Test" or "TST" we would also get a match. 

Is there anyway to override the auto-complete logic using custom code?

Regards,
Ben

3 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 12 Mar 2009, 07:32 PM
Hello Ben,

Thank you for writing.

I am afraid that the combobox does not offer convenient means of overriding the autocomplete behavior - you will have to disable the autocomplete functionality of your combo, subscribe to the TextChanged event and implement your own custom logic for auto completion.
 
Please write back if you have other questions.
 

Sincerely yours,
Victor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ben
Top achievements
Rank 1
answered on 29 Mar 2009, 08:53 PM
Thanks Victor,

You don't happen to have any examples of this sort of thing floating around? It would greatly aid me in my task if you did. 

Thanks again.
Ben
0
Victor
Telerik team
answered on 31 Mar 2009, 08:42 AM
Hello Ben,

Thank you for writing. I am afraid that we do not have a ready example. You could try googling for C# autocomplete logic or something similar. I found this, it is a rather long post but contains useful ideas. Feel free to write back if you want to ask something else.

Greetings,
Victor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Ben
Top achievements
Rank 1
Answers by
Victor
Telerik team
Ben
Top achievements
Rank 1
Share this question
or