Bug in CompareValidator ?

R

Radu

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb"
Inherits="Test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox
ID="PINTextBoxAdd"
MaxLength="6"
AutoCompleteType="disabled"
Runat="Server">
</asp:TextBox>
<asp:RegularExpressionValidator
id="regexPINAdd"
ControlToValidate="PINTextBoxAdd"
Display="Dynamic"
ValidationExpression="^\d{6}$"
Text="*"
ErrorMessage="The Employee's PIN is not correct !"
runat="server">
</asp:RegularExpressionValidator>
<asp:CompareValidator
id="comparePINAdd"
ControlToValidate ="PINTextBoxAdd"
ValueToCompare="100000"
Operator="GreaterThan"
Display="Dynamic"
Text="*"
ErrorMessage="The Employee's PIN has to be greater than
100,000 !"
runat="server">
</asp:CompareValidator>
<asp:ValidationSummary
id="validSummaryAdd"
ShowSummary="false"
ShowMessageBox="true"
runat="server"/>
<asp:Button ID="Button1" Text="Submit" runat="server" />
</div>
</form>
</body>
</html>

Try with 0. You get BOTH messages.
Try with 1. You get BOTH messages.
Try with >1. You get only "The Employee's PIN is not correct !" The
compare validator does not trigger anymore. Is this a normal
behaviour ?

Thank you.
Alex.
 
H

Hans Kesting

Radu wrote on 23-12-2008 :
<asp:CompareValidator
id="comparePINAdd"
ControlToValidate ="PINTextBoxAdd"
ValueToCompare="100000"
Operator="GreaterThan"
Display="Dynamic"
Text="*"
ErrorMessage="The Employee's PIN has to be greater than
100,000 !"
runat="server">
</asp:CompareValidator>
Try with 0. You get BOTH messages.
Try with 1. You get BOTH messages.
Try with >1. You get only "The Employee's PIN is not correct !" The
compare validator does not trigger anymore. Is this a normal
behaviour ?

Thank you.
Alex.

Add a property: Type="Integer"
The default is "String" and that gives different results, as you found
out..

Hans Kesting
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top