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.
<ValidationProp erty("Validatio nValue")> _
Public Class ValidifiableChe ckBox : Inherits
System.Web.UI.W ebControls.Chec kBox
Private mValidationTrue Value As String = Boolean.TrueStr ing
Public Property ValidationTrueV alue() As String
Get
Return mValidationTrue Value
End Get
Set(ByVal value As String)
mValidationTrue Value = value
End Set
End Property
Public ReadOnly Property ValidationValue () As String
Get
If Me.Checked Then
Return mValidationTrue Value
Else
Return System.String.E mpty
End If
End Get
End Property
End Class