Handle the ServerValidate method of your CustomValidator control as follows.
Set the args.IsValid equal to True if everything tests to be correct,
otherwise set it false.
Private Sub CustomValidator1_ServerValidate(ByVal source As
System.Object, ByVal args As
System.Web.UI.WebControls.ServerValidateEventArgs) Handles
CustomValidator1.ServerValidate
Try
If chkGreat.Checked Or chkGood.Checked Then
args.IsValid = True
ElseIf chkNotSoGreat.Checked Or chkAwful.Checked Then
args.IsValid = (txtComments.Text.Trim() <"")
Else
args.IsValid = False
End If
Catch ex As Exception
'whatever
End Try
End Sub
"Mike Collins" wrote:
If possible, how can I use a custom validator to check (client side) that if
a certain value was checked in a checkboxlist? So, if they checked "great" or
"good", comments are not required and if they checked "not so great" or
"awful", comments would be required before allowing the page to post.