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

TextBox with suggestion feature

4 Answers 97 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 06 Jun 2013, 02:36 PM
Hi there,

I have a textbox in which the user can freely enter text. However I have the requirement to display a list of suggestions from a collection of strings.
I tried to achieve this behavior using the RadAutoCompleteBox or the RadComboBox, but both of them only allowed to select strings already existing. The collection of strings used as suggestions cannot be modified.

Do you have any hint on how to get the desired behavior?

Regards,
Markus

4 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 11 Jun 2013, 02:48 PM
Hello,

If the desired behavior is to have a suggestion list with the possibility of adding new items on for example enter keyboard key press all you need to do when using RadAutoCompleteBox is to handle the KeyDown event and in it add the new item with the use the SearchText property which represents the entered text in the control.

I created and attached a sample project for you with the described approach, hope this is helpful.

Regards,
Vladi
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Markus
Top achievements
Rank 1
answered on 24 Jun 2013, 01:47 PM
Hello,

thank you for your reply Vladi. The solution you described does not provide the desired behavior, because the underlying collection of strings is immutable. Thus I try to clarify my requirements:

- The user can enter any text he wants
- The control provides suggestions as the user types, but the user is not bound to this suggestions
- The list of strings used for the suggestions never gets modified

Is there any Telerik control providing these features?

Best regards,
Markus
0
Accepted
Vladi
Telerik team
answered on 25 Jun 2013, 12:36 PM
Hi,

In the current version of RadControls there isn't a control that has that exact behavior but there are properties of the RadAutoCompleteBox control that could be used in order to achieve it. When a text is typed in the control its SearchText property is populated with that text no matter if there is or there isn't a match in the DropDown portion of the control. And when a item is selected the SelectedItem is populated. With those properties you could easily get the text when no selection is made (no match) or a selection was made.

I recorded a short video and attached a sample project of the previously described approach, hope this is helpful.

Regards,
Vladi
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Markus
Top achievements
Rank 1
answered on 22 Jul 2013, 05:47 PM
Hi Vladi,

thank you for your effort - Somehow I managed not to notice your last answer. I don't have the time to test your solution now as I am busy with some other stuff at the moment, but I will get back to you once I find some time to do so!

Regards,
Markus
Tags
General Discussions
Asked by
Markus
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Markus
Top achievements
Rank 1
Share this question
or