RequiredFieldValidator switching on and off AND TextChanged events not firing

  • Thread starter Thread starter PromisedOyster
  • Start date Start date
P

PromisedOyster

1. I have a series of RequiredFieldValidators that need to be be
enabled/disabled depending on what the user types into various text
boxes.

Can I do this using the Enabled property of the validator. Or should I
use the CausesValidation on the control?

2. Also, with my text boxes, I am not getting the TextChanged events
firing. I tried changing the AutoPostBack property on the text box to
true but this still did not fire the event? What am I doing wrong?

(Note it is within these TextChanged events that I am attempting to
disable the validators).

Sorry if this is a simple ASP.NET question but I have mostly been using
WinForms.
 
To answer your first question: yes, the Enabled property is how you turn
on/off validators.

As for the second question, setting AutoPostBack="true" and
OnTextChanged="..." should work. If you could post your code, it will
be easier for us to figure out what is going wrong.

-bgano
 
Back
Top