I am writing a custom validator by extending CustomValidator in order to
validate three fields as follows:
If checkbox true then textboxA and textboxB must have data in.
The problem I am having is that whether the checkbox is ticked or not it
returns the value "on" to my validator code. This is all using the ideas of
DanielHac as at http://www.codeproject.com/aspnet/Mu...dValidator.asp &
he suggests extending the checkbox control as below. Despite doing this I
still ahvev the porblem.
Any ideas?
-------------------------------------------------------------
'Replacement for standard checkbox.
'This allows the checked property to be read by validation controls.
'Standard microsoft support for clienside validation of a checkbox is broken.
<ValidationProperty("ValidationValue")> _
Public Class ValidifiableCheckBox : Inherits
System.Web.UI.WebControls.CheckBox
Private mValidationTrueValue As String = Boolean.TrueString
Public Property ValidationTrueValue() As String
Get
Return mValidationTrueValue
End Get
Set(ByVal value As String)
mValidationTrueValue = value
End Set
End Property
Public ReadOnly Property ValidationValue() As String
Get
If Me.Checked Then
Return mValidationTrueValue
Else
Return System.String.Empty
End If
End Get
End Property
End Class