ASP.NET controls added dynamically not visible from the code behind

Alereerak

New Member
I'm adding a dynamically built set of checkboxes to an asp.net page from the code behind with something like this in a recursive fashion:\[code\]pnlPageAccessList.Controls.Add(myCheckboxControl);\[/code\]The controls show up fine on the page, but they don't show up when I view source, nor can I access them from the code behind.If I add the controls in the on_init method, they work. But I have some business rules driving changes to the list of controls itself that require I fire the add method elsewhere. Has anyone seen this before? I'm away from work so I can't copy the exact code. I have two terrible ideas for how to get it working. One involves some jQuery and a set of hidden controls holding a big array of integers; the other is run the method on_init AND on my other events so the controls at least show up. Both smell like ugly hacks. The second one I suspect won't work to read the values out of the checkboxes.
 
Back
Top