I thought I could do this to, but it doesn't seem to be working. Maybe my
approach is wrong. I am doing exactly this in my page load method (in the
area of code that only executes if it IS a postback). The Controls
collection for my panel, that I added the checkboxes to in page load (not in
a post back), is empty. I thought the viewstate would rebuild the controls
and the panel's Controls collection would have many controls in it. Is this
the case because I'm dynamically adding CheckBox controls to the panel?
Thanks.
<> wrote in message
news: oups.com...
> In the Panel codebehind or in whatever Control you are adding the
> checkboxes *directly* to just iterate through the Control collection by
> number. The index will correspond to exactly what order you added them
> in, so you'll have to know that.
>
> foreach(Control control in this.Controls)
> {
> if(control is CheckBox)
> {
> CheckBox checkBox = (CheckBox) control;
> // here is your checkbox
> }
> }
>
> something liket this anyway
>
|