Disable some ASP.Net validation controls when a checkbox is checked

后端 未结 3 568
挽巷
挽巷 2021-02-06 01:25

I\'m using old fashioned ASP.NET validation (ugh) for a checkout process. I have a checkbox -\"I\'ll call with my credit card details\"-. If checked I need to disable the requir

3条回答
  •  既然无缘
    2021-02-06 01:36

    You can disable the validators server-side:

    MyFieldValidator.Enabled = MyCheckBox.Checked
    
    Page.Validate()
    If Page.IsValid Then
       'stuff
    end if
    

提交回复
热议问题