I have tried to get the validation to work with this control, but have failed miserably trying to implement as you have described here - https://docs.telerik.com/devtools/aspnet-ajax/controls/checkboxlist/functionality/aspnet-validators-support
It never validates on the client. I have two controls, one a textbox the other a checkboxlist. the textbox does fail correctly, the checkboxlist never fails. Using your code, i can still not get to happen what you describe - "To use the RequiredFieldValidator, you just need to set the ControlToValidate property to the CheckBoxList's ID. This will trigger validation when the user submits and the validation control will validate against the SelectedItem property and return the appropriate validation result."
1) Please help get this thing to validate correctly using the asp validators are described in your documentation.
2) Seems there is indeed an issue with the get_selectedIndex(), as it should have the correct index after the "checked" has been fired. use my code below and checkout what the alert sends back. At the checked changed event it should have the correct index, no? I even get "undefined" when after unchecking and checking a box. It should always be "-1" or a number of the first selected item index number, if checked. This issue breaking the validation?
<
div
style
=
"float: left; width: 100%;"
>
<
telerik:RadCheckBoxList
runat
=
"server"
ID
=
"RadCheckBoxListMembers"
AutoPostBack
=
"false"
RenderMode
=
"Lightweight"
ClientIDMode
=
"Static"
>
<
ClientEvents
OnItemCheckedChanged
=
"OnItemCheckedChanged"
OnLoad
=
"function(sender) { radCheckBoxList = sender; }"
/>
<
Items
>
<
telerik:ButtonListItem
Text
=
"All Family"
Value
=
"-1"
/>
<
telerik:ButtonListItem
Text
=
"Bob"
Value
=
"0"
/>
<
telerik:ButtonListItem
Text
=
"Mary"
Value
=
"1"
/>
<
telerik:ButtonListItem
Text
=
"Jimmy"
Value
=
"2"
/>
</
Items
>
</
telerik:RadCheckBoxList
>
<
asp:RequiredFieldValidator
runat
=
"server"
ErrorMessage
=
"Please select a member(s)"
ValidationGroup
=
"ValidationGroup"
Display
=
"None"
ControlToValidate
=
"RadCheckBoxListMembers"
EnableClientScript
=
"true"
/>
</
div
>
<
div
style
=
"float: left; width: 100%;"
>
<
telerik:RadTextBox
runat
=
"server"
ID
=
"RadTextBoxName"
Label
=
"Name:"
/>
<
asp:RequiredFieldValidator
runat
=
"server"
ErrorMessage
=
"Please enter a name"
ValidationGroup
=
"ValidationGroup"
Display
=
"None"
ControlToValidate
=
"RadTextBoxName"
EnableClientScript
=
"true"
/>
</
div
>
<
div
style
=
"float: left; width: 100%;"
>
<
telerik:RadButton
runat
=
"server"
ID
=
"RadButtonSubmit"
CausesValidation
=
"true"
ValidationGroup
=
"ValidationGroup"
Text
=
"Submit"
RenderMode
=
"Lightweight"
AutoPostBack
=
"true"
Width
=
"200px"
Enabled
=
"true"
OnClick
=
"RadButtonSubmit_Click"
>
<
Icon
PrimaryIconCssClass
=
"rbOk"
/>
</
telerik:RadButton
>
</
div
>
<
div
style
=
"float: left; width: 100%;"
>
<
asp:ValidationSummary
runat
=
"server"
ValidationGroup
=
"ValidationGroup"
/>
</
div
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
//![CDATA[
var radCheckBoxList;
function OnItemCheckedChanged(sender, args) {
alert(radCheckBoxList.get_selectedIndex());
}
//]]>
</
script
>
</
telerik:RadScriptBlock
>