views:

45

answers:

1

Using the ValidationProperty I've managed to connect a RequiredFieldValidator with my custom control. When I enable client script in the validator, JavaScript errors occur.

Is there a way to tell the RequiredFieldValidator how it can validate my custom control in the client?

+1  A: 

In the first instance ensure the ControlToValidate property is pointing at the control you wish to validate.

Worryingly the JavaScript error is a bit weird as using RequiredFieldValidator would emit the stock ASP.NET validation code.

You could used a Custom Validator where you define the JavaScript method you want to execute to perform the validation.

brumScouse
I consider this a valid solution too, so +1 from me.I've actually solved this issue by letting the custom JavaScript control generate an hidden field which the validators can connect to. As much as that is a workaround, it also allows all standard validators to work.
vdboor