comparevalidator

How can I use CompareValidator for times without dates?

When I enter 9:00 into the Start control, and 16:00 into Finish; the code below fails validation. Does anybody know a way I can use the ASP.NET validator for times without the dates? Start <asp:TextBox ID="txtStart" runat="server" /> (hh:mm) <br /> Finish <asp:TextBox ID="txtFinish" runat="server" /> (hh:mm) <br /> <asp:CompareValidato...

Button_Click Event not raised due to CompareValidator

I have a page containing an <asp:Button/> to leave the page and a <asp:TextBox/> to get some date and another <asp:TextBox/> to confirm that data. The confirm validator is configured as follows: <asp:CompareValidator ID="CompareValidator" runat="server" ErrorMessage="error message" ControlToValidate="ConfirmTextBox" ControlToCompare="Te...

How to change the ValueToCompare in CompareValidator by javascript?

In my form, there are password field, so that I cannot use postback. I need to validate everything in client side. But the ValueToCompare may change by the user input. How to change the ValueToCompare in CompareValidator by javascript? Thanks. ...

ASP.NET: Validate text box contains integer greater than equal to zero?

If I want to validate that a text box contains an integer greater than or equal to zero. Do I need to use TWO asp:CompareValidator controls: one with a DataTypeCheck operator and one with a GreaterThanEqual operator? Or is the datatype operator redundant? Can I just use a single validator with the GreaterThanEqual operator (and the ty...

ASP.NET CompareValidator compare against sub control

I have a custom control "FieldGroup" which contains an asp:TextBox and some other functionality. The asp:TextBox is exposed through a public property "TextBox". On the page that uses my FieldGroup I am having a password entry which means I have two of them and I want to use a CompareValidator to confirm that the values are the same. I c...

How do I get the Compare Validator to work server side?

I have this compare validator: <asp:CompareValidator ID="cpvBirthDate" Type="Date" ControlToValidate="txtBirthDate" Operator="DataTypeCheck" runat="server" ErrorMessage="Please enter a valid date in this format mm-dd-yy"> <img src="Images/ExclamationMark.gif" alt="Please enter a valid date in this format mm-dd-yy" /> </asp:C...

CompareValidator currency check does not work with French formatted numbers

I have a salary TextBox and an associated CompareValidator, which is setup as follows: <asp:CompareValidator ... Operator="DataTypeCheck" Type="Currency" /> I fill the TextBox with a formatted string out of the database: txtSalary.Text = myObject.Salary.ToString("N2") When a user accesses the page using a French culture (such as fr...

How to Use compare validator

Please tell me how to apply compare validater for password and confirm password in ASP.NET MVC2. Please give me some good link or any sample. Thanks ...