Recommended way to add child controls in CreateChildControls

  • Thread starter Thread starter paul.hester
  • Start date Start date
P

paul.hester

Hi all,

What is the recommended way to add child controls *around* existing
child controls in the CreateChildControls method (e.g. table, row and
cell controls for layout purposes)?

Is the best way to keep a reference to the existing child controls,
clear the Controls collection and then re-add everything along with the
layout controls, or insert the layout controls around the existing
controls in the existing Controls collection?

Thanks,

Paul
 
If I try to modify the Controls collection, I get a "The Controls
collection cannot be modified because the control contains code blocks"
error because my controls contain literal content (i.e. <%=
SomeValue%>). If I change the literal content to a <%# %> tag it
doesn't get picked up and is rendered empty.

Is there any way to insert layout controls around the existing controls
and preserve the literal content?

Any help would be appreciated. I'm stuck on this one.

Thanks,

Paul
 
Back
Top