By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,855 Members | 1,988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,855 IT Pros & Developers. It's quick & easy.

Required Validator on CheckBoxList

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
"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

P: n/a
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

P: n/a
"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.