Validator positioning.

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
F

Frank Rizzo

My web page is in the FlowLayout Mode. I have 2 validators for a
textbox field: a RequiredFieldValidator and RegularExpressionValidator –
essentially to make sure that the user entered something into the Email
textbox and to make sure that whatever is entered is syntactically a
valid email. How can I force the error to appear in the same place.
The designer will not let me place both validators into the same spot in
Flow Layout mode. As a result, depending on which validator is engaged
the error appears in a different location. The validator code is below.


<asp:RegularExpressionValidator
id="validateEmailRegEx"
runat="server"
ControlToValidate="txtEmail"
ErrorMessage="Bad email"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
</asp:RegularExpressionValidator>

<asp:RequiredFieldValidator
id="validateEmail"
runat="server"
ControlToValidate="txtEmail"
ErrorMessage="Enter a valid (no, really) email.">
</asp:RequiredFieldValidator>


Thanks.
 
set the Display property for the validation controls to dynamic...
doing that it would not occupy permanent space in your rendered html would
rather be added and made visible on error

--
Regards,

HD

Once a Geek.... Always a Geek
 
Hermit said:
set the Display property for the validation controls to dynamic...
doing that it would not occupy permanent space in your rendered html would
rather be added and made visible on error

You are the man. Simple answer for a simple question.
 
Back
Top