Click here to Skip to main content
15,887,746 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: kinect with web Pin
Richard MacCutchan3-Jun-14 22:04
mveRichard MacCutchan3-Jun-14 22:04 
QuestionRepeater Control with show and hide boxes Pin
indian1433-Jun-14 10:41
indian1433-Jun-14 10:41 
AnswerRe: Repeater Control with show and hide boxes Pin
DamithSL3-Jun-14 16:47
professionalDamithSL3-Jun-14 16:47 
GeneralRe: Repeater Control with show and hide boxes Pin
indian1435-Jun-14 7:14
indian1435-Jun-14 7:14 
QuestionBeginner to Visual Studio Pin
Member 87616672-Jun-14 13:31
Member 87616672-Jun-14 13:31 
AnswerRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 1:20
mveRichard Deeming3-Jun-14 1:20 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 2:14
Member 87616673-Jun-14 2:14 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 2:49
mveRichard Deeming3-Jun-14 2:49 
Once again, from MSDN:

Compares the value entered by the user in an input control with the value entered in another input control, or with a constant value.

So the question is, what are you trying to compare your email address to?

For example, if you wanted the user to enter their email address twice, you would have a CompareValidator with its ControlToValidate pointing to the second TextBox, and its ControlToCompare pointing to the first TextBox. The validator would then check that the user had entered the same value in both controls.

If you wanted to make sure the user had entered a specific value, you would leave the ControlToCompare blank, and set the ValueToCompare instead. The validator would then check that the user had entered the specified value.

From the error message, I'm guessing that you want to validate the format of the email address. If that's the case, then you'll probably want to use a RegularExpressionValidator instead[^]:
aspx
<asp:RegularExpressionValidator runat="server" ControlToValidate="strEmail" 
    CssClass="text-danger" Display="Dynamic" ErrorMessage="Please enter a valid email address."
    ValidationExpression="^.+@.+$"
/>

The ValidationExpression property uses Regular Expressions[^] to validate the entered value against a pattern. You can find some quite complicated email address patterns on the internet, but most of them have problems with some email addresses. It's generally simplest just to validate that the address contains an "@" character, and has characters before and after it.

You should probably spend some time reading about validation in ASP.NET - try Understanding ASP.NET Validation Techniques[^] or ASP.NET Quickstart Tutorials : Validating Form Input Controls[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 5:07
Member 87616673-Jun-14 5:07 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 5:45
mveRichard Deeming3-Jun-14 5:45 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 6:14
Member 87616673-Jun-14 6:14 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 6:36
mveRichard Deeming3-Jun-14 6:36 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 6:58
Member 87616673-Jun-14 6:58 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 7:20
mveRichard Deeming3-Jun-14 7:20 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 7:32
Member 87616673-Jun-14 7:32 
GeneralRe: Beginner to Visual Studio Pin
Richard Deeming3-Jun-14 7:49
mveRichard Deeming3-Jun-14 7:49 
GeneralRe: Beginner to Visual Studio Pin
Member 87616673-Jun-14 8:12
Member 87616673-Jun-14 8:12 
QuestionHttpApplicationState Pin
jkirkerx2-Jun-14 13:17
professionaljkirkerx2-Jun-14 13:17 
Answer[SOLVED] Pin
jkirkerx2-Jun-14 13:26
professionaljkirkerx2-Jun-14 13:26 
SuggestionRe: [SOLVED] Pin
thatraja3-Jun-14 21:13
professionalthatraja3-Jun-14 21:13 
GeneralRe: [SOLVED] Pin
jkirkerx4-Jun-14 5:52
professionaljkirkerx4-Jun-14 5:52 
QuestionMicrosoftAjax.js broken in Windows 8.1? Pin
Richard Deeming2-Jun-14 8:49
mveRichard Deeming2-Jun-14 8:49 
QuestionDirect Print Pin
Dana_Wahab1-Jun-14 23:58
Dana_Wahab1-Jun-14 23:58 
AnswerRe: Direct Print Pin
Kornfeld Eliyahu Peter2-Jun-14 0:42
professionalKornfeld Eliyahu Peter2-Jun-14 0:42 
QuestionI have problem with my nested control in datalist Pin
marjan_198630-May-14 22:09
marjan_198630-May-14 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.