Sorry, I don't speak VB ;-) so I can't give you exact code.
But the easiest way to do this is to loop through the "Items" collection of
the datalist. Use the "FindControl" method on each DataListItem to find your
checkbox, then you should be able to work out if it's checked or not. In C#
it would look like this:
int checkCount = 0;
foreach (DataListItem item in myDataList) {
Checkbox cbx = (Checkbox) item.FindControl("checkboxID");
if (cbx.Checked) {
checkCount++;
}
}
Hope that helps -
/gerrod
"Derek" wrote:
I have a Datalist that contains several fields, one of which is a checkbox.
When the user clicks a submit button, I need to be able to determine how many
of the checkboxes in the datalist were checked. I am doing the page in
ASP.NET using VB.
Thanks, in advance, for any assistance any of you could provide.