RequiredFieldValidator fired when no validation needed

  • Thread starter Thread starter Vik
  • Start date Start date
V

Vik

In VS 2005, on a page there is a dropdownlist and a RequiredFieldValidator
for that list. There are also two buttons - an "Add" button with
CausesValidation = True and a "Search" button with CausesValidation = False.

The first value in the dropdownlist is Null. If I select some value in the
DDL and then select Null in this list, then the RequiredFieldValidator
immidiately displays a message though no button was clicked and no
validation should be done at this time. If I click the Search button, the
validator disappears and search is executed.

How can I make the validator to fire only when the page is submitted (that
was a behavior in VS 2003)?

Thanks.
 
Validators have always triggered their validation when you either submit the
form or the control to validate loses its focus. This is not new behavior
(it worked like this in VS 2003).

If you don't want the validation when the control loses the focus, you'll
have to write your own validator.

-Scott
 
Back
Top