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

LoadOnDemand and CustomValidator

2 Answers 52 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Berlioz
Top achievements
Rank 1
Berlioz asked on 27 Nov 2011, 10:03 PM
How do you use the CustomValidator and RadComboBox together WHEN LOADONDEMAND is enabled??? Because If user wants to supply a value freehand by typing it in, I have to 1.make sure it is not left on "--- PLEASE SELECT---"  2. check input value against a regex, 2. insert the value into the db if not already there. Please help!

2 Answers, 1 is accepted

Sort by
0
Accepted
Kevin
Top achievements
Rank 2
answered on 28 Nov 2011, 02:23 PM
Hello Daniel,

I posted on your other topic, but I'm assuming this is the real issue you want answered. The way I validate the RadComboBox when I used LoadOnDemand is like so:

if (dropDown.get_text() != null && dropDown.get_text() != dropDown.get_emptyMessage()) {
                    args.IsValid = true;
                }

I hope that helps.
0
Ivana
Telerik team
answered on 29 Nov 2011, 05:53 PM
Hello Daniel,

Yes, Kevin is right about the empty text and the empty message check.

If you want to save the text typed in the input field, in a database, you could, before a post-back to the server is made, check if an item with such a text already exist in the items collection. To achieve this, you could use the FindItemByText(text) method of the RadComboBox's client object.

For more information about the client-side API of the RadComboBox, you could refer to the following help article: RadComboBox: Client-side API.

I hope this helps.

Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
Berlioz
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Ivana
Telerik team
Share this question
or