Hello all,
I would prefer to use an asp.net Validation Control as I currently have other Validation Controls within the same View. I need to error messages to be displayed wihtin a Validation Summary.
I have two textboxes and I need to make sure than textboxA is LessThan textboxB.
I have used the CompareValidator and have set the properties to:
- ControlToCompare: textboxB
- ControlToValidate: textboxA
- Operator: GreaterThan / Also tried LessThan
- Type: Date
Here is the problem:
- When I provide a time within textboxA and move onto textboxB the validation error is displayed. I thought my if statement would fix this but it doesn’t.
Within the Click Event for the 'Update' button I have added the following code, as I only need it to validate if both textboxA/textboxB != null.
if(String.IsNullOrEmpty(textboxB.Text))
{
Debug.Write("Valid");
timeCompareValidator.IsValid = true;
}
Thanks in advance for any help.
Clare