Bashing my head against this and seeking ideas. I have an ASP.NET page which contains a bunch of checkboxes in a panel. They are standalone checkboxes, not a checkboxlist and need to be that way so that they can be formatted on the page. private
Upon submitting the form, I need to loop through each checkbox and see if it is checked, and take action. Here's my code:
foreach (CheckBox ck in pnlCheckboxes.Controls)
privatevoid butSubmit_Click(object sender, System.EventArgs e)
... do stuff
The code compiles and at runtime errors at the foreach statement with the error "Specified cast is not valid"
Any ideas? I've used similar code to loop through the checkboxes in a checkboxlist, but need to do it with standalone controls.