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

Validate Value instead of Text...

1 Answer 119 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Cedric
Top achievements
Rank 2
Cedric asked on 15 Apr 2008, 11:31 PM
Hello,

I'm wondering if Telerik team plan to make the validation (Ex.: RequiredFieldValidator) with the value selected in the RadComboBox instead of the selected text like actually?

For sure I can use a CustomValidator but why use a CustomValidator when a RequiredFieldValidator can normally easily do the job.

Thanks for your help

Cedric

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 16 Apr 2008, 10:37 AM
Hi Cedric,

Welcome to Telerik Community!

Indeed - this would have been the more logical approach, especially given that the standard <asp:dropdownlist> control validates against Value as well. However, we had some technical difficulties trying to validate against Value.

The combobox is a composite control, its input area being essentially a <input type"text" ...> DOM element. The .value property of this DOM element corresponds to the actual text being written inside the textbox. This is not the case with <asp:dropdownlist> which corresponds to DOM <select> element and a number of <option> elements of ListItems which have different value / text properties.


Even the validation is performed against the Text property, you can still use the RequiredFieldValidator.

Attached, you can find a page with two comboboxes. One of them is validated with CustomValidator and the other with RequiredFieldValidator.

Please download it and give it a try.

Sincerely yours,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
Cedric
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Share this question
or