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)
{
if(ck.Checked ==
true)
{
... 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.
Aaron
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.