468,532 Members | 1,768 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Required Validator on CheckBoxList

Can you use a Required Validator on a CheckBoxList?

You can on a RadioButtonList.

But when I try on my CheckBoxList I get the error:

Control 'RFPServiceTypes' referenced by the ControlToValidate property of
'ServiceTypesCheck' cannot be validated

<asp:CheckBoxList id="RFPServiceTypes" CellPadding="0" CellSpacing="0"
runat="server"/>
<asp:RequiredFieldValidator id="ServiceTypesCheck"
ControlToValidate="RFPServiceTypes"
text = "You Must Choose At Least One Service Type"
runat="server"/>

I just want to make sure that one of the checkboxes are checked.

Thanks,

Tom
Nov 19 '05 #1
3 6136
"tshad" <ts**********@ftsolutions.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Can you use a Required Validator on a CheckBoxList?

You can on a RadioButtonList.

But when I try on my CheckBoxList I get the error:

Control 'RFPServiceTypes' referenced by the ControlToValidate property of
'ServiceTypesCheck' cannot be validated

<asp:CheckBoxList id="RFPServiceTypes" CellPadding="0" CellSpacing="0"
runat="server"/>
<asp:RequiredFieldValidator id="ServiceTypesCheck"
ControlToValidate="RFPServiceTypes"
text = "You Must Choose At Least One Service Type"
runat="server"/>

I just want to make sure that one of the checkboxes are checked.
I found that you apparently can't.

But I found a couple of places that show you how to create a custom
validator that does the trick.

Tom
Thanks,

Tom

Nov 19 '05 #2
Tom,

If you want a validator that acts on the checkboxlist exactly the same way
as the built in validator works on a radio button list (and lets you set how
many checkboxes need to be selected) I built one and am giving it away,
including source, on my website, www.aboutfortunate.com. If you'd like to
download it click the "Code Library" button at the top of the page and then
click the "Check Box Required Field Validator" button that will appear in
the menu on the left.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"tshad" <ts**********@ftsolutions.com> wrote in message
news:um**************@TK2MSFTNGP14.phx.gbl...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Can you use a Required Validator on a CheckBoxList?

You can on a RadioButtonList.

But when I try on my CheckBoxList I get the error:

Control 'RFPServiceTypes' referenced by the ControlToValidate property of
'ServiceTypesCheck' cannot be validated

<asp:CheckBoxList id="RFPServiceTypes" CellPadding="0" CellSpacing="0"
runat="server"/>
<asp:RequiredFieldValidator id="ServiceTypesCheck"
ControlToValidate="RFPServiceTypes"
text = "You Must Choose At Least One Service Type"
runat="server"/>

I just want to make sure that one of the checkboxes are checked.


I found that you apparently can't.

But I found a couple of places that show you how to create a custom
validator that does the trick.

Tom

Thanks,

Tom


Nov 19 '05 #3
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP14.phx.gbl...
Tom,

If you want a validator that acts on the checkboxlist exactly the same way
as the built in validator works on a radio button list (and lets you set
how many checkboxes need to be selected) I built one and am giving it
away, including source, on my website, www.aboutfortunate.com. If you'd
like to download it click the "Code Library" button at the top of the page
and then click the "Check Box Required Field Validator" button that will
appear in the menu on the left.
I hadn't seen this post, when I responded to your other post.

Thanks for the help.

This will help me get a better handle on the making changes to different
classes. I have another one dealing with radio buttons and Datagrids that I
wanted to make a change to, but hadn't got to it yet.

Thanks,

Tom

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"tshad" <ts**********@ftsolutions.com> wrote in message
news:um**************@TK2MSFTNGP14.phx.gbl...
"tshad" <ts**********@ftsolutions.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Can you use a Required Validator on a CheckBoxList?

You can on a RadioButtonList.

But when I try on my CheckBoxList I get the error:

Control 'RFPServiceTypes' referenced by the ControlToValidate property
of 'ServiceTypesCheck' cannot be validated

<asp:CheckBoxList id="RFPServiceTypes" CellPadding="0" CellSpacing="0"
runat="server"/>
<asp:RequiredFieldValidator id="ServiceTypesCheck"
ControlToValidate="RFPServiceTypes"
text = "You Must Choose At Least One Service Type"
runat="server"/>

I just want to make sure that one of the checkboxes are checked.


I found that you apparently can't.

But I found a couple of places that show you how to create a custom
validator that does the trick.

Tom

Thanks,

Tom



Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by dm_dal | last post: by
2 posts views Thread by Martin | last post: by
4 posts views Thread by Shaul Feldman | last post: by
5 posts views Thread by Eirik Eldorsen | last post: by
1 post views Thread by Sam Collett | last post: by
reply views Thread by bcutting | last post: by
4 posts views Thread by Patrick.O.Ige | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.