Custom Validator not firing?

May 6, 2012

Just tripped up on something that has caught me before!

Having added a CustomValidator control to the page and written the associated client side/server side validation methods I compiled and tested to find the validation methods were not being fired. This is because the CustomValidator control does not fire unless there is a value in the textbox.

“But my control won’t always have a value” you scream!

This is the default value for the CustomValidator controls ValidateEmptyText property, i.e. It is set to False by default.

To fix this, either add a RequiredFieldValidator also, so your users have to enter something, or set the ValidateEmptyText property to True (ValidateEmptyText=”True”).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: