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

Prevent search text to set value not in the combobox

5 Answers 102 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 10 Apr 2012, 02:14 PM
Hi,

We have a combobox with search capabilities via the IsEditable property. However, we need to enforce the rule that the combobox-textbox can not contain values that are not in the combobox list of existing values. Is there an easy way to do it or do we need to add plumbing code to do so.

TW

5 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 12 Apr 2012, 01:16 PM
Hello,

You could set the IsReadOnly property to True - that will disable typing and selecting items which are not in the ItemsSource of the ComboBox.

All the best,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Tony
Top achievements
Rank 1
answered on 12 Apr 2012, 01:50 PM
Hi Konstantina,

The customer doesn't want to disable typing, but they just don't want to endup with a text that is not in the combobox list of values. They also want to see the resulting text as they're typing of course. It's a very hard requirement as far as UI behavior is concern.

TW
0
Yana
Telerik team
answered on 17 Apr 2012, 01:16 PM
Hi Tony,

In this case I would suggest to validate the Text of the ComboBox as demonstrated in the following example:
http://demos.telerik.com/silverlight/#ComboBox/Validation

Kind regards,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tony
Top achievements
Rank 1
answered on 17 Apr 2012, 02:21 PM
Hi Yana,

We're already using the validation in our controls. However, the users still wants to completely limit the resulting text to only the ones in the combobox.

TW
0
Accepted
Yana
Telerik team
answered on 18 Apr 2012, 09:45 AM
Hello Tony,

There is not built-in functionality in RadComboBox which you can use to achieve this requirement. However, you can try to subscribe to KeyDown event of the control and check the entered text in its handler.

Hope this helps.

Greetings,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ComboBox
Asked by
Tony
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Tony
Top achievements
Rank 1
Yana
Telerik team
Share this question
or