Validating a CheckBox with ASP.NET validators?

L

Lars Netzel

Hi

How do I validate a CheckBox with a formvalidator from ASP.NET ? I can't
find anyway to do it and I need the look of this validation to look like the
rest of the textbox validators on the form (which are using
RequiredFieldValidators). Please help!

Best Regards
/Lars
 
G

Guest

Hi!

You have to decide _what_ to validate on the CheckBox. I did this recently,
but there is no automagic way to validate a boolean. :) IE. it could be that
you wanted it not to be checked off. (Who does..)
What I did was to use a CustomValidator with a client side script checking
if the checkbox is checked. I think there is an example in the .net framework
documentation for CustomValidator. If you can't find it, give me a hint and
I'll provide the example here. (Got it on another computer ;) )

HTH,
Lars-Erik
 
L

Lars Netzel

I made my own check instead. Doesnt' look the same but it work. Thanx anyway

/Lars
 
B

Brock Allen

You'll need to use a CustomValidator control. You can provide client side
javascript in addition to your server validation event.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top