Using CustomValidator

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?
 
H

http://www.visual-basic-data-mining.net/forum

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top