472,805 Members | 837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 6292
"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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.