Nour
Nour

Reputation: 5459

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)< what is all about?

i saw few of solutions for this exception (like putting it in place holder, or replace the <% to <# ...etc) , but i don't get the idea about it, i mean what is the controls collection? and why it can't be modified if the added control contains code blocks ?

Upvotes: 0

Views: 798

Answers (2)

Elad Lachmi
Elad Lachmi

Reputation: 10581

I think the idea is to not create contention on the content of the element between the code in the <%%> tags and the code-behind file. They both change the content of the element and asp.net doen`t know who needs to "win".

Upvotes: 1

flq
flq

Reputation: 22859

I would expect code blocks to be called during Render, while much of the server-side control behaviour happens before render.

Upvotes: 0

Related Questions