RadAutoCompleteBox Allow only ONE token to be selected.

2 Answers 229 Views
AutoCompleteBox
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Roger asked on 22 Jun 2021, 01:53 PM | edited on 22 Jun 2021, 01:54 PM

I have a RadAutoCompleteBox working as expected allowing user to type and pick an item from the list.

The token is then shown in the Textbox as expected.

 

Would like to have a way when they type again and pick another item, to then remove the 1st and only show the 2nd item.

Tried the  radautocompletebox.Text = "" but received some error.  It would be nice to have a property stating (Multiple Tokens (true/false).

 

Maybe there is a programmatically way to click the X in the token to remove it before adding the 2nd token?

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Roger
Top achievements
Rank 2
Iron
Iron
Iron
answered on 22 Jun 2021, 02:01 PM

I found that I can check the Text of the AutoCompleteBox.  If it is not empty then issue the Clear() method.

Example:

if(!string.IsNullOrEmpty(racTypeOfContent.Text))
                racTypeOfContent.Clear();

0
Nadya | Tech Support Engineer
Telerik team
answered on 23 Jun 2021, 03:58 PM

Hello, Roger,

I am glad to hear that you managed to found a suitable solution. Clearing the existing tokenized items when picking another item is a valid approach in achieving your requirement.

In case you have any other questions do not hesitate to ask.

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
AutoCompleteBox
Asked by
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Nadya | Tech Support Engineer
Telerik team
Share this question
or