I have a RadComboBox in an edit template of a grid with a RequiredFieldValidator. The combo box is set to to Filter="Contains", with an empty message of "--Select--". The RequiredFieldValidator will stop them from submitting if they have not entered any text, however it will not stop them if they have not selected at item. If they try filtering by a value that is not in the list and hit save without selecting it will not prevent this action.
I tried using a CompareValidator but I can't get it to fire when nothing is selected. Also I believe this would only compare the text they have entered as it grabs the Text field and not the Value field.
Is there a Validator I can use to verify they have actually selected an item when allowing filtering, or will I need to write some javascript validation for this?
Thanks,
James
I tried using a CompareValidator but I can't get it to fire when nothing is selected. Also I believe this would only compare the text they have entered as it grabs the Text field and not the Value field.
Is there a Validator I can use to verify they have actually selected an item when allowing filtering, or will I need to write some javascript validation for this?
<
telerik:GridTemplateColumn
Display
=
"false"
UniqueName
=
"colClass"
HeaderText
=
"Class"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblClass"
Text=<%# Eval("Class") %> ></
asp:Label
>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"cbbClass"
DataSourceID
=
"classesDS"
OnSelectedIndexChanged
=
"cbbClass_SelectedIndexChanged"
AutoPostBack
=
"true"
EmptyMessage
=
"--Select a Class--"
Filter
=
"Contains"
DataValueField
=
"Class_ID"
DataTextField
=
"Class"
SelectedValue = <%# Eval("Class_ID") %> ></
telerik:RadComboBox
>
<
asp:RequiredFieldValidator
runat
=
"server"
ID
=
"cbbClassValidator"
ValidationGroup
=
"SessionSave"
ErrorMessage
=
"You must select a Class!"
Text
=
"*"
Display
=
"Dynamic"
ControlToValidate
=
"cbbClass"
></
asp:RequiredFieldValidator
>
<
asp:CompareValidator
runat
=
"server"
ID
=
"cbbClassValidator2"
ValueToCompare
=
""
Operator
=
"NotEqual"
ControlToValidate
=
"cbbClass"
Display
=
"Dynamic"
ErrorMessage
=
"You must select a Class2!"
Text
=
"*"
ValidationGroup
=
"SessionSave"
/>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
Thanks,
James