only My site

Monday, January 16, 2012

Error : The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>)

Error : The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>)

Answer : the workaround is to wrap a tag around the <% ... %>code block. This makes the code block a child of the Placeholder control, instead of being a direct child of the Page.Header control, but it doesn't change the rendered output at all. Now that the code block is not a direct child of Page.Header you can add things to the header's controls collection without error.

Source : Stackoverflow

No comments: