.NETGURU
Compare Validator Case Insensitive?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspng-validators' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Scott Cate
How do you make a compare validator case insensitive?

Tia,
Scott

Reply to this message...
 
    
Steven A Smith (VIP)
I don't think this functionality is supported by default. The only
supported comparisons are those given by the ValidationCompareOperator
enumeration. One of these is Equal, which for strings should only work if
they really are equal, as opposed to if the lowercase of both sides are
equal.

You can either use a CustomValidator or perhaps subclass the
CompareValidator and override its Compare() method.

Steve

----- Original Message -----
From: "Scott Cate" <Click here to reveal e-mail address>
To: "aspng-validators" <Click here to reveal e-mail address>
Sent: Tuesday, April 02, 2002 1:18 AM
Subject: [aspng-validators] Compare Validator Case Insensitive?

[Original message clipped]

Reply to this message...
 
    
Scott Cate
Because I wanted it to work client side, this is the another reason for
me to lean back to a reg ex validator.

All I need to check is if the exact name admin is entered.
I don't care if it's administrator, admins, adin only "admin"
And it case insensitive.

Can you think of a reg ex that'll do that?

Scott Cate

-----Original Message-----
From: Steven A Smith [mailto:Click here to reveal e-mail address]
Sent: Monday, April 01, 2002 11:33 PM
To: aspng-validators
Subject: [aspng-validators] Re: Compare Validator Case Insensitive?

I don't think this functionality is supported by default. The only
supported comparisons are those given by the ValidationCompareOperator
enumeration. One of these is Equal, which for strings should only work
if they really are equal, as opposed to if the lowercase of both sides
are equal.

You can either use a CustomValidator or perhaps subclass the
CompareValidator and override its Compare() method.

Steve

----- Original Message -----
From: "Scott Cate" <Click here to reveal e-mail address>
To: "aspng-validators" <Click here to reveal e-mail address>
Sent: Tuesday, April 02, 2002 1:18 AM
Subject: [aspng-validators] Compare Validator Case Insensitive?

[Original message clipped]

| [aspng-validators] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspng-validators.asp = JOIN/QUIT

Reply to this message...
 
    
Steven A Smith (VIP)
You want it to be valid or not valid in that case?

If only 'admin' is valid, then it's easy: ^admin$

Of course, as Scott Mitchell mentioned, you might be best off just going
with string comparison. There's no reason you can't do a custom validator
that also includes some client-side script. That's the purpose of the
ClientValidationFunction property of the Custom Validator. You could just
add your function, IsAdmin(), to the WebUIValidation.js file, or do a
register client script block, or even stick it in a literal. Your
javascript should be really simple, too. Just do a .toLower() on the
textbox's contents and compare it with 'admin' and return the result.

Steve

----- Original Message -----
From: "Scott Cate" <Click here to reveal e-mail address>
To: "aspng-validators" <Click here to reveal e-mail address>
Sent: Tuesday, April 02, 2002 1:47 AM
Subject: [aspng-validators] Re: Compare Validator Case Insensitive?

[Original message clipped]

Reply to this message...
 
 
System.Web.UI.MobileControls.CompareValidator
System.Web.UI.MobileControls.CustomValidator
System.Web.UI.WebControls.CompareValidator
System.Web.UI.WebControls.CustomValidator
System.Web.UI.WebControls.ValidationCompareOperator




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification