views:

411

answers:

2

I am trying to parse the html side of an aspx page from the C# code behind.

Essentially I have a with multiple checkboxes that are named as such:

qlcbXX with XX being an id of an item pulled from a database.

What i would like to do is

a) parse linkSelections for all the checkbox inputs

b) determine if they are checked

c) if checked add to a list called keepList else add to list called removeList

Any ideas?

Thanks

-Seth

+1  A: 
 I think this would work:



 void IterateControls(Control parent)
         {
                    foreach (Control c in parent.Controls)
                    {
                        if (c is CheckBox)
                        {
                          keepList.Add(c);
                        }else
                        {
                          removeList.Add(c);
                        }

                        if (c.Controls.Count > 0)
                        {          
                          IterateThroughChildren(c);          
                        }
                    }
          }
Dan
+1  A: 

Use a CheckBoxList and make everything a lot simpler.

Bryan Rowe