Ramblings & Controls from a .NET Addicted Freak!

Kevin Gearing's Blog

New Control - StringCompareValidator - Provides Case Sensitive Comparisons

If like me you've made use of the standard CompareValidator you'll know that it lacks one important feature for comparing strings - Case sensitivity. Whilst working on another control I needed a compare validator that had this capability, so I've created my own custom control - StringCompareValidator.


  • CaseSensitive property to allow case-sensitive or case-insensitive comparisons.
  • CompareOperator property to allow equal or not equal comparisons.
  • Provides client-side and server-side validation.
  • Full Visual Studio .NET designer integration.


Simply download, add to your toolbox, drag 'n' drop to your page and set the relevant properties using the property grid.

Licensing & Download:

Free for both personal and commercial use, however please consider donating!

You may also redistribute the control royalty free, providing that you don't charge for it. Also, if you intend to distribute the control as part of an application which is publicly available it would be nice to know, although this isn't a requirement.

To download, please visit the 'Downloads' area.

Help & Support:

Please post in the forum.


Revision History:

Updated 05/06/2007 (v2.0.0):

Click here for details.

Published Oct 30 2004, 06:26 PM by dotNetFreak
Filed under: ,



Dominic said:

Hi Kevin,

I added Formshield and also your StringCompareValidator to my aspx page. I am using the web express edition

I followed your instructions by drag and drop the .dll file into the tool box. I set controltocompare=mytextbox; controltovalidate=formshield. However, it is not validating correctly after clicking submit to add a record. It would let me add even I didn't match up them up. I set casesensitive=false. matchtype=string. CompareOperator=Equal.

I also did save and build-website everytime I made a change in the properties of these controls.

I don't know why it didn't work. Please help out. Thanks in advance.
August 13, 2006 10:41 AM

Dominic said:

Kevin, it will work only if I set "Encryptquerystring=false". I read one of your posts and you stated that it is unsafe to set it to "false". How can I leave it at "true" and still have the Formshield to work correctly. Thanks.

August 13, 2006 11:28 AM

Feras said:

I'm having that same problem Dominic, all I did was use both controls and follow the instructions, but it won't validate. I even tried setting Encryptquerystring = false but that didnt work.
September 28, 2006 1:09 AM

Kevin Gearing said:

Dominic & Feras:

Set EncryptQueryString = True on FormShield and then set EnableClientScript = False on the validator.

The validator cannot validate client-side if EncryptQueryString is True as no value is written out to the browser.

Hope that helps!

July 10, 2007 8:35 PM

New Control - FormShield - Dynamically Generates CAPTCHA??? Style Images - Kevin Gearing's Blog said:

Pingback from  New Control - FormShield - Dynamically Generates CAPTCHA??? Style Images - Kevin Gearing's Blog

February 17, 2009 5:01 PM

StringCompareValidator for .NET 2.0 Released - Kevin Gearing's Blog said:

Pingback from  StringCompareValidator for .NET 2.0 Released - Kevin Gearing's Blog

February 17, 2009 5:03 PM

Leave a Comment


Protected by FormShield
Please enter the characters shown on the image


Copyright ©2004-2007 Kevin Gearing. All Rights Reserved.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems