Controls collection cannot be modified ...

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>
 
G

Gregory A. Beamer

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! |
*******************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top