手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >解决 The Controls collection cannot be modified because the control contains code blocks
解决 The Controls collection cannot be modified because the control contains code blocks
摘要:在.aspx或.ascx的如果包括,并在.aspx,.ascs中使用了AjaxToolkit中的控件,那么很可能会引发"TheControl...

在.aspx或.ascx的如果包括<%= %>,并在.aspx, .ascs中使用了AjaxToolkit中的控件,那么很可能会引发"The Controls collection cannot be modified because the control contains code blocks" 异常,

解决办法如下

1. 将<%= 换为<%#

2. 在.asp或模板页中的Page_Load事件中添加如下代码

复制代码 代码如下:

Page.Header.DataBind();

【解决 The Controls collection cannot be modified because the control contains code blocks】相关文章:

ASP.NET中MVC 4 的JS/CSS打包压缩功能

ASP.net Substitution 页面缓存而部分不缓存的实现方法

新手入门:C++下的引用类型

ASP.NET.4.5.1+MVC5.0设置系统角色与权限

web.config使用方法指南

asp.net中IDataParameter调用存储过程的实现方法

ASP.NET 2.0/3.5中直接操作Gridview控件插入新记录

AlternatingItemTemplate类似于 ItemTemplate 元素

找不到类型或命名空间名称“Server”(是否缺少 using 指令或程序集引用?)

ASP.NET 2.0 中收集的小功能点(转)

精品推荐
分类导航