0

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

4

2 回答 2

1

使用 CheckBoxList 让一切变得更简单。

于 2009-07-23T14:16:38.813 回答
1
 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);          
                        }
                    }
          }
于 2009-07-23T14:00:53.890 回答