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. Validation Question

Validation Question

Scheduled Pinned Locked Moved ASP.NET
question
5 Posts 5 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.
  • M Offline
    M Offline
    matthias s 0
    wrote on last edited by
    #1

    Hi there, I've got 2 custom controls on a webform. Each custom control consists of a TextBox, a RequiredFieldValidator and a Button. The RequiredFieldValidators have ClientScript enabled but should only get fired when the matching button is clicked, that is: when the user hits ButtonA, the RequiredFieldValidatorA should validate TextboxA. Everything ending with a 'B' should be left alone. But by default, both RequiredFieldValidators display their messages. Can I avoid this? Thanks in advance! /matthias

    I love deadlines. I like the whooshing sound they make as they fly by.
    [Douglas Adams]

    C M T 3 Replies Last reply
    0
    • M matthias s 0

      Hi there, I've got 2 custom controls on a webform. Each custom control consists of a TextBox, a RequiredFieldValidator and a Button. The RequiredFieldValidators have ClientScript enabled but should only get fired when the matching button is clicked, that is: when the user hits ButtonA, the RequiredFieldValidatorA should validate TextboxA. Everything ending with a 'B' should be left alone. But by default, both RequiredFieldValidators display their messages. Can I avoid this? Thanks in advance! /matthias

      I love deadlines. I like the whooshing sound they make as they fly by.
      [Douglas Adams]

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Create a validator on the button that checks the text of the textbox. I reckon you'd have to write this yourself. Christian Graus - Microsoft MVP - C++

      1 Reply Last reply
      0
      • M matthias s 0

        Hi there, I've got 2 custom controls on a webform. Each custom control consists of a TextBox, a RequiredFieldValidator and a Button. The RequiredFieldValidators have ClientScript enabled but should only get fired when the matching button is clicked, that is: when the user hits ButtonA, the RequiredFieldValidatorA should validate TextboxA. Everything ending with a 'B' should be left alone. But by default, both RequiredFieldValidators display their messages. Can I avoid this? Thanks in advance! /matthias

        I love deadlines. I like the whooshing sound they make as they fly by.
        [Douglas Adams]

        M Offline
        M Offline
        minhpc_bk
        wrote on last edited by
        #3

        Hi Matthias, As the ASP.NET 1.x does not support the group of validators, so in addition to Christian's suggestion, you may try to enable/disable the validator depending on which button is clicked accordingly by setting the enabled property to true/false. However, this way seems to be a bit more complicated.

        1 Reply Last reply
        0
        • M matthias s 0

          Hi there, I've got 2 custom controls on a webform. Each custom control consists of a TextBox, a RequiredFieldValidator and a Button. The RequiredFieldValidators have ClientScript enabled but should only get fired when the matching button is clicked, that is: when the user hits ButtonA, the RequiredFieldValidatorA should validate TextboxA. Everything ending with a 'B' should be left alone. But by default, both RequiredFieldValidators display their messages. Can I avoid this? Thanks in advance! /matthias

          I love deadlines. I like the whooshing sound they make as they fly by.
          [Douglas Adams]

          T Offline
          T Offline
          totig
          wrote on last edited by
          #4

          Hi. I was facing the very same problem that you have. I could not find anyway of doing this, so I eventually decided to write my own validations, which are actually better, as I have more control and i can specify exactly what gets validated depending on user input.

          N 1 Reply Last reply
          0
          • T totig

            Hi. I was facing the very same problem that you have. I could not find anyway of doing this, so I eventually decided to write my own validations, which are actually better, as I have more control and i can specify exactly what gets validated depending on user input.

            N Offline
            N Offline
            neoms21
            wrote on last edited by
            #5

            You can also use custom validator for the purpose they will solve your problem. neoms21

            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