views:

388

answers:

3

I need to have a custom validator that can in some way incorporate a custom variable when calling the client-side javascript validation. This validator is used in a repeater, and every item in the repeater needs to use the custom validator, but validating against its own variable. Is this possible and how can I do it?

Example, I need its javascript validation function to be like JavascriptValidation(sender, args, MYVARIABLE)

Or is there any way to incorporate my variable in the 'args'? I'm not sure what that is.

Thanks!

A: 

Where exactly does the variable come from? i.e. is it available in the DOM?

If it is, could you get the value of the DOM node in your custom validator?

If not, it might be best to disable client-side validation and just validate on the server.

Ian Oxley
The variable is from the database. Each record will have a different value for this variable. I could make it a hidden field and get the value from that if that's what you're talking about, but I still need a way to get it in the custom validator's javascript method, and the hidden field would be in a Master Page, in a Repeater nexted in another repeater, so without being able to add its ID to the javascript call I don't see how I could incorporate that.
Ryan
Looks like it might be easiest to just bite the bullet and set EnableClientScript="false" on your CustomValidator and validate solely on the server.
Ian Oxley
A: 

I have posted one article for Client side custom validation in repeater. it might be useful for others.

A: 

i want save 1 values into client site without session, can you help me!

trivv