Can I run a standard ASP.NET compare validator on the autocompletebox? I want to test if the initial value was changed. If not trigger it. I running this in dropdownlist mode.
Thanks!
3 Answers, 1 is accepted
0
Nencho
Telerik team
answered on 13 Jan 2017, 11:30 AM
Hello David,
Could you please elaborate a bit more on the usage of the CompareValidator, so we could have more context on the issue and locally tests it. Provide us with a sample code snippet of the utilization at your end.
On things like dropdowns I usually use the compare validator as a required field validator as opposed to the standard required field validator. Since I have text already in the box to start, my initial value, I was just wondering if I can use that as the property and will it validate.
Since the RadAutoComplete entries are not contained in the input of the control, I would suggest you to use a CustomValidator and a HiddenField. You can set the value of the HiddenFIeld regarding the currently contained entries in the AutoComplete at page load.
In addition, you can use the ClientValidate function of the CustomValidator, in order to implement the comparison. In the attachment you can find a sample example, demonstrating the above suggestion.