I'm currently wondering about server side validation of a field.
For example I have a field which can't be blank, must be a number & must be under the value of 999999.
Example code to validate would be:
If checkNumeric(txtBaseSalary.Text) = True Then
txtBaseSalary.CssClass = "text"
Else
x += 1
step_4 += 1
txtBaseSalary.CssClass = "text error"
End If
If val(txtBaseSalary.Text) = 0 or val(txtBaseSalary.Text) > 999999 Then
x += 1
step_4 += 1
txtBaseSalary.CssClass = "error text"
Else
txtBaseSalary.CssClass = "text"
End If
However I'm sure you've spotted the issue, if it fails the first validation but passes the second the error amount (step_4) will go up, however if passes the second then the visual representation is cleared.
Does anyone have any implementations of doing multiple validations against a field without nested if statements?
As well, please provide solutions that could apply to any situation where multiple validation is required, not simply here is a way you can validate that one situation I've posted.