Friday, March 5, 2010

The Controls collection cannot be modified because the control contains code blocks

10:26 AM Posted by Unknown No comments
This is a common error. It occurs when we use <%= %> tag inside the head tag with runat="server" given. You can get rid of the error by removing the runat="server" from the head tag. But, sometimes, we want to keep that. We can use <%# %> instead of <%= %>. But, then, the value may not get bound and we may not get the value of the expression. So, when we use <%# %>, we have to add Page.Header.DataBind(); in the Page Load event.
More Info

0 comments:

Post a Comment