手机
当前位置:查字典教程网 >编程开发 >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】相关文章:

DataGrid同时具有分页和排序功能及注意点

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

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

asp.net aspnetpager分页统计时与实际不符的解决办法

web.config使用方法指南

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

C# 判断两张图片是否一致的快速方法

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

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

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

精品推荐
分类导航