I need to disable all RequiredFieldValidators on my web page but my code does not seem to be working.

               ValQ1.Enabled = False
      ValQ2.Enabled = False
      ValQ3.Enabled = False
      ValQ4.Enabled = False
      ValQ5.Enabled = False
      ValQ6.Enabled = False
      ValQ7.Enabled = False
      ValQ8.Enabled = False
      ValQ9.Enabled = False
      ValQ10.Enabled = False

In some parts of my code this is working and in others it just isn't

Any ideas? I need to completely remove validation if a certain sutuation arises.

Cheers

Paul G
pgilfeatherAsked:
Who is Participating?
 
arif_eqbalCommented:
strange I'll simulate it here and see

0
 
arif_eqbalCommented:
Does it still Validate or just displays the message???

try ValQ10.Visible=False for all validators
0
 
pgilfeatherAuthor Commented:
Both, it validates and shows the message.

I have tried valQ10.visible =False

I have also tried

ValQ10.EnableClientScript=false

It is the first thing that is being called in the procedure.
0
 
123654789987Commented:
According to the link below u have to set the ClientTarget attribute in the Page directive to "downlevel" to disable client side script

http://www.codeproject.com/aspnet/groupvalidator.asp
0
 
pgilfeatherAuthor Commented:
The client Target works but it simply disables all validation all of the time and this is not what I want. I want to be able to control the validation.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.