手机
当前位置:查字典教程网 >编程开发 >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开发中正则表达式中BUG分析

ASP.NET连接MySql数据库的2个方法及示例

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

asp.net Reporting Service在Web Application中的应用

浅谈ASP.NET中最简单的自定义控件

C/C++中利用空指针简化代码,提高效率

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

AlternatingItemTemplate类似于 ItemTemplate 元素

ASP.NET MVC3 实现全站重定向的简单方法

asp.net 因为数据库正在使用的解决方法

精品推荐
分类导航