Wednesday, December 17, 2008

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

I've observed this error many times when <% %> (inline code blocks) are used in master page.

For e.g.

style src='<%=siteurlvariable%>' etc...

Somehow master page does not seems to be entertaining to this and shows .net CODE IN browser wholla!

Fix:

1/
Put your code as
style src='<%# siteurlvariable%>'

2/
Write following piece of code in masterpage.page_load...
Page.Header.Databind()

It Works!

No comments:

Post a Comment