What happens to asp:CompareValidator in the client side : CompareValidator « Validation « ASP.NET Tutorial






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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Total number of children:
        <asp:TextBox ID="totalChildren" runat="server" Columns="4"></asp:TextBox>
        <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="totalChildren"
            ErrorMessage="The total number of children must be a whole number greater than or equal to 0"
            Operator="GreaterThanEqual" Type="Integer" ValueToCompare="0"></asp:CompareValidator><br />
        <br />

        <asp:Button ID="btnSubmit" runat="server" Text="Click Me" />
        <br />
        <br />
        <asp:Label ID="results" runat="server"></asp:Label></div>
    </form>
</body>
</html>

File: Default.aspx.vb


Partial Class MyPage
    Inherits System.Web.UI.Page

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        If Page.IsValid Then
            results.Text = "Input is valid..."
        Else
            results.Text = "Input is <b>not</b> valid..."
        End If

    End Sub
End Class








8.2.CompareValidator
8.2.1.CompareValidator performs three different types of validations
8.2.2.CompareValidator performs a comparison against a fixed value.
8.2.3.CompareValidator compares the value of one form field against another form field.
8.2.4.asp:CompareValidator, Type='String', Operator='NotEqual' and ErrorMessage
8.2.5.What happens to asp:CompareValidator in the client side
8.2.6.Set DeleteParameters, InsertParameters and UpdateParameters for asp:SqlDataSource
8.2.7.Using the CompareValidator to test values against other control values
8.2.8.Using the CompareValidator to validate against constants
8.2.9.To specify the data types: Currency, Date, Double, Integer, String
8.2.10.Making comparisons with the CompareValidator control
8.2.11.CompareValidator for number, text and password
8.2.12.Disable Client Validation
8.2.13.Use CompareValidator to check password field and confirm password field
8.2.14.CompareValidator with age field
8.2.15.Check birthday