C#错误:The Controls collection cannot be modified

用 <%# %>这种写法是写在数据绑定控件中的,之所以用 <%= %>会出现The Controls collection cannot be modified because the control contains code blocks 这个错误,是因为这段代码是写在 <head> </heda>中的,而且head加了runat="server",所以它会出现这个错误,把这段js移到 </head>和 <body>之间就ok。

我遇到的困难有点类似但不同,我用的多国语言,在head标记中用了<%=Resources.FrontResource.alert1
%>
显示标题错误,替换成<%#Resources.FrontResource.alert1%>就正常了。

上一篇:一个表中多个字段对应另一个表的ID(SQL查询)


下一篇:mybatis 关于 Parameter Maps collection does not contain value for