Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Can a Compare validator fire when either of two controls changes?

Can a Compare validator fire when either of two controls changes?

Scheduled Pinned Locked Moved ASP.NET
question
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    darookie99
    wrote on last edited by
    #1

    From what I have read, a Compare validator only fires when the ControlToValidate changes (not the ControlToCompare). How can I get a validator that fires when either of two controls change?

    B Z K 3 Replies Last reply
    0
    • D darookie99

      From what I have read, a Compare validator only fires when the ControlToValidate changes (not the ControlToCompare). How can I get a validator that fires when either of two controls change?

      B Offline
      B Offline
      Brij
      wrote on last edited by
      #2

      You question is looking Good. You can go for custom validator or try using two compare validator for both the controls.

      Cheers!! Brij Microsoft MVP ASP.NET/IIS Visit my Blog: http://brijbhushan.net

      D 1 Reply Last reply
      0
      • D darookie99

        From what I have read, a Compare validator only fires when the ControlToValidate changes (not the ControlToCompare). How can I get a validator that fires when either of two controls change?

        Z Offline
        Z Offline
        ZurdoDev
        wrote on last edited by
        #3

        Yes, you'll have to use 2.

        There are only 10 types of people in the world, those who understand binary and those who don't.

        1 Reply Last reply
        0
        • D darookie99

          From what I have read, a Compare validator only fires when the ControlToValidate changes (not the ControlToCompare). How can I get a validator that fires when either of two controls change?

          K Offline
          K Offline
          Keith Barrow
          wrote on last edited by
          #4

          Yes, that is one of it's intended uses. you need to set the ControlToValidate and ControlToCompare to the ID of the controls you want to compare. There is documentation on it here[^], the main things you need to set are the Type property (seeh here[^]) and the Operator property (see here[^]) as well as the various display stuffm such as the error message. It is possible to have more complex validation of controls, but you need to hand-roll your own JavaScript and Code-behind. [Edit] Totally misread your question, sorry! I think it validates of either is changed, but you've sown the seed of doubt in my mind! It wouldn't make sense to validate on only one control...

          Sort of a cross between Lawrence of Arabia and Dilbert.[^]
          -Or-
          A Dead ringer for Kate Winslett[^]

          1 Reply Last reply
          0
          • B Brij

            You question is looking Good. You can go for custom validator or try using two compare validator for both the controls.

            Cheers!! Brij Microsoft MVP ASP.NET/IIS Visit my Blog: http://brijbhushan.net

            D Offline
            D Offline
            darookie99
            wrote on last edited by
            #5

            Thanks for the answer. I ended up programing it with two custom validators. When I entered the one I would clear the message (if there was one) of the other.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups