[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

How to use the CompareValidator control?

I need to implement a text box control with following validation rules:
(1) It should not be blank
(2) It should NOT equal to the string "Please enter your name here"

For first condition, I use Required field validator, it works fine.
For second condition, I think about using CompareValidator. But I need assistance on
(1) How do you set the property of "control to compare"? It compares to itself, actually. Do we need to set it anyway?
(2) How to set the property "Value to compare"? I set it to be the string above. But how do you set condition evaluation to be TRUE or FALSE?
0
chuang4630
Asked:
chuang4630
  • 2
2 Solutions
 
atul_parmarCommented:
1. the property "control to compare" here you have to set/select the name of control you want to compare with (in your case you can leave it
2. the property "Value to compare" = "Please enter your name here"
3. To set the how to evalute there is operator property what should be
Equal
GreaterThan
GreaterThanEqual
LessThan
LessThanEqual
NotEqual
DataTypeCheck
0
 
TornadoVCommented:
You can set 'Initial Value' of your "Required validator" control to "Please enter your name here", you don't even need to use Compare Validator.  
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now