473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 6321
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dm_dal | last post by:
Is there a know issue surrounding the CheckBoxList control and it's viewstate? When my control is created, it's ListItems are checked as needed, but on a postback, they loose their Selected...
2
by: Martin | last post by:
Dear Group It says in MSDN that a field can be associated with more than one validators but can one validator be associated with more than one field? Or do I need a validator for each field? How...
4
by: Shaul Feldman | last post by:
Hello, I have something really awkward at work - fighting with CheckBoxList... How can I define CSS for ListItem in CheckBoxList programmatically. I add CheckBoxList's Items on the fly, something...
5
by: Eirik Eldorsen | last post by:
I'm trying to code a reapter that for each listelement show a checkboxlist. I'm almost there. The only thing I can't figure out is how to set the ID of the checkboxlists. This is my code:...
1
by: Sam Collett | last post by:
Is there a way of having a required field validator check to see if at least one of a set of controls has information in it? I'm sure this can somehow be done using a custom validator, but would...
2
by: pmud | last post by:
Hi, I have an ASP.Net web page . The page was working fine until I added a required field field validator. My page has a link button which takes the user to another page, a submit button which...
0
by: bcutting | last post by:
I have a control which inherits from TextBox and supplies some additional data functionality. I was hoping to include a boolean flag "Required" that can be set in the designer. When the flag is...
5
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.