Using CustomValidator

  • Thread starter Thread starter anony
  • Start date Start date
A

anony

I think the problem is that your custom validator for the textbox doesn't
fire if the field is empty. So when the dropdown item that you want to
force input to your textbox gets selected, the custom validator doesn't do
any checking since the field is empty.

I have a similar situation where I want to require input to a textbox if a
particular option from a dropdown is selected. Anyone know how to achieve
this using built in validators without a postback?
 
I would like to validate a field but with an "If" statement to check whether
that field should be mandatory or optional based on the option that the user
has selected from a dropdownlist. I used the CustomValidator to do the
checking.

This is my server-side validation:



Client-side validation:


In the body tag:

*

When I clicked the Submit button, regardless of the value that I chose from
the dropdown (ddlCover), there's no error message. So, I'm not sure whether
it's my code problem or not.
 
Back
Top