I have a web page where a fields needs to be validated if another is not empty. e.g. 'date' needs to be checked if 'quantity' has a number in it. I’m not exactly a pro with .net and am fiddling with compare and custom validators. All help on how/if this can be done much appreciated
Thanks Ramesh S, this is great. Exactly what I was looking for.
Just in case anyone is interested , here is the same script in VB:
Protected Sub btnValidate_Click(ByVal sender As Object, ByVal e As EventArgs)
If Not [String].IsNullOrEmpty(txtQuantity.Text) Then
Dim qty As Integer = Integer.Parse(txtQuantity.Text)
If qty > 0 Then
If [String].IsNullOrEmpty(txtDate.Text) Then
cvValidateDate.ErrorMessage = "Date must be entered"
cvValidateDate.IsValid = False