469,938 Members | 2,492 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,938 developers. It's quick & easy.

requiredvalidator for checkbox

Is there no way to require a checkbox to be checked in ASP.NET?
The requiredvalidator control doesn't work for it--should I make a
server--roundtrip for that and check during the btn_click event? Is there
another way?

Thanks,
Shane
Nov 17 '05 #1
3 2817
I've used a CustomValidator, and wrote some client side javascript to do
this type of check. That way you will avoid the roundtrip.

You could just as easily forgo the validators, and just write your own
routine for this, but I had some other validators on the page that were
being displayed in a validation summary, so it was more convenient.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:eu**************@TK2MSFTNGP11.phx.gbl...
Is there no way to require a checkbox to be checked in ASP.NET?
The requiredvalidator control doesn't work for it--should I make a
server--roundtrip for that and check during the btn_click event? Is there
another way?

Thanks,
Shane

Nov 17 '05 #2
custom validators do not require you to set that property. You can leave it
blank. Be sure to define a javascript function, and list it in the property
that speficies which client side function to run for the validation.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:ew**************@TK2MSFTNGP10.phx.gbl...
Yeah I know, but when I click ControlToValidate for, the checkbox controls
don't list????

How did you handle that?

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:er*************@tk2msftngp13.phx.gbl...
I've used a CustomValidator, and wrote some client side javascript to do
this type of check. That way you will avoid the roundtrip.

You could just as easily forgo the validators, and just write your own
routine for this, but I had some other validators on the page that were
being displayed in a validation summary, so it was more convenient.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:eu**************@TK2MSFTNGP11.phx.gbl...
Is there no way to require a checkbox to be checked in ASP.NET?
The requiredvalidator control doesn't work for it--should I make a
server--roundtrip for that and check during the btn_click event? Is there another way?

Thanks,
Shane



Nov 17 '05 #3
Muchas gracias! :)

I am very glad that someone answered that question for me.

Shane

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl...
custom validators do not require you to set that property. You can leave it blank. Be sure to define a javascript function, and list it in the property that speficies which client side function to run for the validation.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me
mail> wrote in message news:ew**************@TK2MSFTNGP10.phx.gbl...
Yeah I know, but when I click ControlToValidate for, the checkbox controls don't list????

How did you handle that?

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:er*************@tk2msftngp13.phx.gbl...
I've used a CustomValidator, and wrote some client side javascript to do this type of check. That way you will avoid the roundtrip.

You could just as easily forgo the validators, and just write your own
routine for this, but I had some other validators on the page that were being displayed in a validation summary, so it was more convenient.

"SStory >" <Sh*********@online.msn.com <remove the 'online.' to send me mail> wrote in message news:eu**************@TK2MSFTNGP11.phx.gbl...
> Is there no way to require a checkbox to be checked in ASP.NET?
> The requiredvalidator control doesn't work for it--should I make a
> server--roundtrip for that and check during the btn_click event? Is

there
> another way?
>
> Thanks,
> Shane
>
>



Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Fabri | last post: by
reply views Thread by mike | last post: by
2 posts views Thread by bebop | last post: by
5 posts views Thread by DotNetJunkies User | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.