Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

howto validate a checkboxlist

0 views
Skip to first unread message

Dan

unread,
Jul 9, 2003, 2:31:02 PM7/9/03
to
I tried using a customvalidator w/server validate function
and a requiredfieldvalidator to ensure one of the
checkboxes was checked in a checkboxlist.

I get this error:

Control 'ckbEchelonList' referenced by the
ControlToValidate property of 'valEchelonList' cannot be
validated.

I also noticed the pulldown to select controls to validate
in the IDE only shows textboxes and listboxes from my
page. So I'm thinking these validation controls can't
validate checkboxlists. Is this so? How do I make sure a
check occurs in a checkboxlist?

David

unread,
Jul 16, 2003, 9:23:32 AM7/16/03
to
Maybe there is a better way, this works for me... Loop through all the
checkboxlist items, and if one is selected, return 'true'...

<code>
oneSelected = false;

for(int i=0; i < CheckBoxList.Items.Count; i++) {

if (CheckBoxList.Items[i].Selected)

oneSelected = true;

}

</code>

"Dan" <mrfix...@nethere.com> wrote in message
news:011201c34648$4016ede0$a501...@phx.gbl...

0 new messages