Validator positioning.

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.
 
H

Hermit Dave

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
 
F

Frank Rizzo

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top