America/US Samples
Europe Samples
Asia Samples

Gaia Ajax: Compare Validator

The Gaia Ajax Compare Validator compares the value entered by the user in an input control with the value entered in another input control, or with a constant value. It inherits from the ASP.NET CompareValidator, and has built-in Ajax behaviour.

Enter a value in the two textboxes. Select a comparison operator and a data type. Click "Validate" to compare values.

String 1:
Comparison Operator:
String 2:
Data Type:

Markup (ASPX/.aspx)

   1:   
   2:      Enter a value in the two textboxes. Select a comparison operator
   3:      and a data type. Click "Validate" to compare values.<br />
   4:      <br />
   5:      <div>
   6:          <div class="verticalStack">
   7:              String 1:<br />
   8:              <gaia:TextBox ID="zCompare1" runat="server" CssClass="input-text" />
   9:          </div>
  10:          <div class="verticalStack">
  11:              Comparison Operator:<br />
  12:              <gaia:DropDownList ID="zOperator" runat="server" OnSelectedIndexChanged="zOperator_SelectedIndexChanged">
  13:                  <asp:ListItem Selected="true" Value="Equal">Equal</asp:ListItem>
  14:                  <asp:ListItem Value="NotEqual">NotEqual</asp:ListItem>
  15:                  <asp:ListItem Value="GreaterThan">GreaterThan</asp:ListItem>
  16:                  <asp:ListItem Value="GreaterThanEqual">GreaterThanEqual</asp:ListItem>
  17:                  <asp:ListItem Value="LessThan">LessThan</asp:ListItem>
  18:                  <asp:ListItem Value="LessThanEqual">LessThanEqual</asp:ListItem>
  19:                  <asp:ListItem Value="DataTypeCheck">DataTypeCheck</asp:ListItem>
  20:              </gaia:DropDownList>
  21:          </div>
  22:          <div class="verticalStack">
  23:              String 2:<br />
  24:              <gaia:TextBox ID="zCompare2" runat="server" CssClass="input-text" />
  25:          </div>
  26:          <div class="verticalStack">
  27:              Data Type:<br />
  28:              <gaia:DropDownList ID="zDataType" runat="server" OnSelectedIndexChanged="zDataType_SelectedIndexChanged">
  29:                  <asp:ListItem Selected="true" Value="String">String</asp:ListItem>
  30:                  <asp:ListItem Value="Integer">Integer</asp:ListItem>
  31:                  <asp:ListItem Value="Double">Double</asp:ListItem>
  32:                  <asp:ListItem Value="Date">Date</asp:ListItem>
  33:                  <asp:ListItem Value="Currency">Currency</asp:ListItem>
  34:              </gaia:DropDownList>
  35:          </div>
  36:          <div class="verticalStack">
  37:              <gaia:Button ID="zValidate" runat="server" Text="--- Validate ---"
  38:                  OnClick="zValidate_Click" CssClass="input-submit" />
  39:          </div>
  40:          <div class="verticalStack">
  41:              <gaia:Label ID="zResult" runat="server" CssClass="resultSpan" />
  42:          </div>
  43:      </div>
  44:      <gaia:CompareValidator ID="zCompareValidator1" runat="server"
  45:          ControlToCompare="zCompare1" ControlToValidate="zCompare2"
  46:          EnableClientScript="False" Type="String" />
  47: