Let's say we have a field that requires two different validation methods, so let's say we have a text box for email, and this text box cannot be empty but at the same time it must be validated whether it's a proper email or not, so automaticly we will end up using two validation controls right here, one is the RequiredFieldValidator to validate whether the box is empty or not and the other one would be RegularExpressionValidator to validate if the email written is in proper email format or not, now the validation is the easy part once you set up these two controls, but my dillima here is that when I put the first validator next to the text box, and I put the other validator next to it, the error messages show up in different locations, the images below should explain the problem.
The following is when the person leaves the field blank:

And the following is when the person enters something, but it's not a proper email address:

Although the images are not that clear, you should notice in the second image that there's a small gap between the error message and the text box, that is because that gap is the place of the first validator (As you can see from image one), but since that validator does not need to be active at that moment, it's dissapearing and leaving a gap.
I would like to have both of these validators within the same location right next to the text box, and depending on the type of error, the error message should be in the same spot and not leave a gap, any ideas on how to do this?
Thank you :)


Sign In
Create Account


Back to top









