Controls collection cannot be modified ...

  • Thread starter Thread starter Cal Who
  • Start date Start date
C

Cal Who

I'm gettig the message:

The Controls collection cannot be modified because the control contains code
blocks (i.e. <% ... %>).
Which I guess is old hat. I've tried many of the suggestions on the Internet
to no avail.

The code below is what I ended up with after removing anything that I
thought could cause the problem.

If comment out this code I do not get the message.

But with it I do.

Looking for suggestion as to what I can try.



Thanks

<asp:Content runat="server" ...snip...

....

<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" >

<ajaxToolkit:TabPanel ID="TabPanelZ1" runat="server" HeaderText='aaa'>

<ContentTemplate>

<asp:Literal Mode="PassThrough" runat="server" Text='sss' />

</ContentTemplate>

</ajaxToolkit:TabPanel>

</ajaxToolkit:TabContainer>

</asp:Content>
 
The Controls collection cannot be modified because the control
contains code blocks (i.e. <% ... %>).
Which I guess is old hat. I've tried many of the suggestions on the
Internet to no avail.

The <% %> is old hat, but the more important question is what you are
trying to accomplish?

One of the easiest ways to introduce/hide controls is by hiding the
container that contains them. This can be done via JavaScript. The ASP.NET
AJAX controls, or at least some, have some built in mechanisms to do this.

In a more "traditional" ASP.NET scenario (postback), you can dynamically
add only the controls you need for a particular "hit", but you have to be
aware of maintaining state for the controls that appear and then disappear
hit after hit.

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top