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 'RFPServiceType s' referenced by the ControlToValida te property of
'ServiceTypesCh eck' cannot be validated
<asp:CheckBoxLi st id="RFPServiceT ypes" CellPadding="0" CellSpacing="0"
runat="server"/>
<asp:RequiredFi eldValidator id="ServiceType sCheck"
ControlToValida te="RFPServiceT ypes"
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 3 6347
"tshad" <ts**********@f tsolutions.com> wrote in message
news:er******** ******@tk2msftn gp13.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 'RFPServiceType s' referenced by the ControlToValida te property of 'ServiceTypesCh eck' cannot be validated
<asp:CheckBoxLi st id="RFPServiceT ypes" CellPadding="0" CellSpacing="0" runat="server"/> <asp:RequiredFi eldValidator id="ServiceType sCheck" ControlToValida te="RFPServiceT ypes" 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
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**********@f tsolutions.com> wrote in message
news:um******** ******@TK2MSFTN GP14.phx.gbl... "tshad" <ts**********@f tsolutions.com> wrote in message news:er******** ******@tk2msftn gp13.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 'RFPServiceType s' referenced by the ControlToValida te property of 'ServiceTypesCh eck' cannot be validated
<asp:CheckBoxLi st id="RFPServiceT ypes" CellPadding="0" CellSpacing="0" runat="server"/> <asp:RequiredFi eldValidator id="ServiceType sCheck" ControlToValida te="RFPServiceT ypes" 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
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> wrote in
message news:%2******** ********@TK2MSF TNGP14.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**********@f tsolutions.com> wrote in message news:um******** ******@TK2MSFTN GP14.phx.gbl... "tshad" <ts**********@f tsolutions.com> wrote in message news:er******** ******@tk2msftn gp13.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 'RFPServiceType s' referenced by the ControlToValida te property of 'ServiceTypesCh eck' cannot be validated
<asp:CheckBoxLi st id="RFPServiceT ypes" CellPadding="0" CellSpacing="0" runat="server"/> <asp:RequiredFi eldValidator id="ServiceType sCheck" ControlToValida te="RFPServiceT ypes" 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 status.
David
|
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 does it work?
Using Handlers?
Thanks for your efforts!
Martin
|
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 like
dim li as ListItem
li = new ListItem("title","value");
'' how to define here the CSS for List Item, not CheckBoxList?!?!?!
myCheckBoxList.Items(x).add(li);
|
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:
<asp:CheckBoxList id='<%#
Convert.ToString(DataBinder.Eval(Container.DataItem, "ID")) %>'
runat="server" .....
This code will result in the following parse error:
|
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 like a validator
that worked like as a custom tag:
<MyValidator:MultipleRequiredFieldValidator
ControlsToValidate="TextBox1,TextBox2,TextBox3" ErrorMessage="You did
not fill in one of the required fields: TextBox1,TextBox2,TextBox3"...
| |
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 takes the values of the text
boxes & puts them into an SQL database.
After adding the required field validator, when I click any button, (be it
submit button ot link button or any other button), it shows the required
field validator's TEXT i.e...
|
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 set to
True the control should include a RequiredFieldValidator for itself.
No matter how I add the validator within the control it never seems to
show up in the page.
protected override void CreateChildControls()
{
if(m_bRequiredField)
|
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 to get a Boolean value TRUE or FALSE when a
checkBox is selected.
When the checkBoxList was out of the DataList i used
"OnSelectedIndexChanged" and it was returning what i wanted but if its in a
|
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 work:(
Thanks
My CheckBoxList in the DataList Below
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |