I have an Asp.Net repeater that contains a text box and a checkbox. I need to add a client side check that checks that when the checkbox is checked, the text box can only accept zero or space.
I would like to use one or more Asp.Net controls to accomplish this in order to ensure consistent display of errors on the client side (errors on the server side are handled by another subsystem).
Asp: CompareValidator doesn't seem flexible enough to do such a complicated comparison, so I stay on the Asp: CustomValidator page.
The problem I am facing is that there seems to be no way to pass user information to a validation function. This is a problem because the ClientIds of the checkbox and text box are unknown to me at runtime (since they are part of the relay).
So ... My options seem like this:
- Pass the text box and checkbox into CustomValidator in some way (it seems not possible).
- Find a TextBox via JavaScript based on the arguments passed using CustomValidator. Is it possible that with ClientId is ambiguous?
- Forget about full validation and release your own JavaScript (allowing me to pass both ClientIds to a user-defined function).
Any ideas on what could be the best way to implement this?
source share