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. Trying to use ASP.NET Custom validator for conditional validation

Trying to use ASP.NET Custom validator for conditional validation

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nettutorial
3 Posts 3 Posters 2 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.
  • U Offline
    U Offline
    User 10420288
    wrote on last edited by
    #1

    Hello, I have a radio button list control on my ASP.NET web form for selecting the payment method (Credit Card, Cheque or Cash), And a credit card detail submission area for entering the credit card details if the user chose Credit Card as the payment method. The credit card detail entering area has a radio button list control for selecting Credit Card type (AMEX, Master or VISA), a text box for entering the credit card number and a drop down list for selecting the credit card expiry month as shown below

      Credit Card
      Cheque
      Cash / Other
    
      American Express
      Master Card
      VISA
    
     Month
     01
     02
     03
     04
     05
     06
     07
     08
     09
     10
     11
     12
    

    I am trying to validate my webform so that, IF and ONLY IF the user select the first option (Credit Card) for payment type, Then the user must ALSO select the credit card type (rdCCType), then enter credit card number (txtCCNumber) and also select credit card expiry month (ddlCCExpiryMonth) I have absolutely no idea how to accomplish this and where to start. Please show me how to do this using ASP.NET validation controls. Thank you.

    J J 2 Replies Last reply
    0
    • U User 10420288

      Hello, I have a radio button list control on my ASP.NET web form for selecting the payment method (Credit Card, Cheque or Cash), And a credit card detail submission area for entering the credit card details if the user chose Credit Card as the payment method. The credit card detail entering area has a radio button list control for selecting Credit Card type (AMEX, Master or VISA), a text box for entering the credit card number and a drop down list for selecting the credit card expiry month as shown below

        Credit Card
        Cheque
        Cash / Other
      
        American Express
        Master Card
        VISA
      
       Month
       01
       02
       03
       04
       05
       06
       07
       08
       09
       10
       11
       12
      

      I am trying to validate my webform so that, IF and ONLY IF the user select the first option (Credit Card) for payment type, Then the user must ALSO select the credit card type (rdCCType), then enter credit card number (txtCCNumber) and also select credit card expiry month (ddlCCExpiryMonth) I have absolutely no idea how to accomplish this and where to start. Please show me how to do this using ASP.NET validation controls. Thank you.

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      You make validation groups, and assign the controls in the credit card code to use the validation group for it. Then assign the submit button that triggers the validation group with the same group. Example: http://www.aspsnippets.com/Articles/Validate-Multiple-Validation-Groups-with-one-Button-in-ASPNet.aspx[^]

      1 Reply Last reply
      0
      • U User 10420288

        Hello, I have a radio button list control on my ASP.NET web form for selecting the payment method (Credit Card, Cheque or Cash), And a credit card detail submission area for entering the credit card details if the user chose Credit Card as the payment method. The credit card detail entering area has a radio button list control for selecting Credit Card type (AMEX, Master or VISA), a text box for entering the credit card number and a drop down list for selecting the credit card expiry month as shown below

          Credit Card
          Cheque
          Cash / Other
        
          American Express
          Master Card
          VISA
        
         Month
         01
         02
         03
         04
         05
         06
         07
         08
         09
         10
         11
         12
        

        I am trying to validate my webform so that, IF and ONLY IF the user select the first option (Credit Card) for payment type, Then the user must ALSO select the credit card type (rdCCType), then enter credit card number (txtCCNumber) and also select credit card expiry month (ddlCCExpiryMonth) I have absolutely no idea how to accomplish this and where to start. Please show me how to do this using ASP.NET validation controls. Thank you.

        J Offline
        J Offline
        joginder banger
        wrote on last edited by
        #3

        you can make the validation group in every radio button and also with in Drop down list. IF you when submit button click check the every validation group, if any validation throw false your button not working. I hope Validation Group help solve your problem.

        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