CompareValidator for case-insensitive string validation

Last post 05-12-2008 9:31 AM by mkamoski. 3 replies.

Sort Posts:

  • CompareValidator for case-insensitive string validation

    05-09-2008, 2:28 PM

    All --

    Please help.

    How can one use the CompareValidator for case-insensitive string validation?

    Please advise.

     

    I see this property...

    ViewStateIgnoresCase

    ...here...

    http://msdn.microsoft.com/en-us/library/system.web.ui.control.viewstateignorescase.aspx 

    ...which may help-- but, I am not sure if it will work or if it is a good way to do it.

     

    I see that some have worked it out with custom code, like this...

    StringCompareValidator - Provides Case Sensitive Comparisons

    http://dotnetfreak.co.uk/blog/archive/2004/10/30/new-control-stringcomparevalidator-provides-case-sensitive-comparisons.aspx 

    ...which may help-- but, I am not sure if it will work or if it is a good way to do it.

     

    So, I am still looking for ideas.

    What do you think?

    Please advise.

     

    Thank you.

    -- Mark Kamoski

  • Re: CompareValidator for case-insensitive string validation

    05-09-2008, 5:02 PM
    • Loading...
    • moises.dl
    • Joined on 09-12-2006, 3:17 PM
    • SLC
    • Posts 425

    nobody likes to come here to click on links to try to help you.....

    but without looking at either of those links if you want to just do ignore case just do it on your own custom code

     string first= "caca";

    string second= "PPOOOPERS";

    if (!first.tolower.equals(second.tolower))

    lblmyErrors.text="caca != ppooopers try again!";

    break;

    +
    I just want to let her know that im money and im here to party...
    +
    Entry Mid Lvl DRAGON MASTER SOFTWARE ENGINEER
  • Re: CompareValidator for case-insensitive string validation

    05-10-2008, 2:27 PM
    Answer
    • Loading...
    • PLBlum
    • Joined on 06-28-2002, 9:20 AM
    • Boston, MA
    • Posts 5,134
    • TrustedFriends-MVPs

    The ViewStateIgnoresCase property is not related to validation.

    The CompareValidator does not support what you request. It always does a case sensitive test with Type=String. (My replacement to the ASP.NET Validators, Peter's Professional Validation, resolves this by offering "String-Case Insensitive" as an option on its own DataType property.)

    To solve this, you will have to use a customvalidator because everytime the existing validators don't match your requirements, you use a CustomValidator.

    --- Peter Blum
    Creator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Package
    www.PeterBlum.com
  • Re: CompareValidator for case-insensitive string validation

    05-12-2008, 9:31 AM

    PLBlum:

    The ViewStateIgnoresCase property is not related to validation.

    The CompareValidator does not support what you request. It always does a case sensitive test with Type=String. (My replacement to the ASP.NET Validators, Peter's Professional Validation, resolves this by offering "String-Case Insensitive" as an option on its own DataType property.)

    To solve this, you will have to use a customvalidator because everytime the existing validators don't match your requirements, you use a CustomValidator.

    Peter --

    I appreciate the excellent reply.

    That's pretty much what I thought and I just needed a guru to confirm it.

    Thank you.

    -- Mark Kamoski

Page 1 of 1 (4 items)