无法修改Controls集合,因为控件包含代码块(即<%.%>).无法更正此错误

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>). cant get this error out

本文关键字:lt gt 错误 集合 Controls 修改 因为 控件 代码 包含      更新时间:2024-06-24

尝试了很多,但无法解决这个错误,我使用脚本和ajax工具包,并更改为<%=…%>还添加了page.header.databind(),但没有使用

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

有人能帮我吗

我的堆栈跟踪是

[HttpException (0x80004005): The Controls collection cannot be modified    because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +9871215
   AjaxControlToolkit.ScriptObjectBuilder.RegisterCssReferences(Control  control) in f:'TeamCity'buildAgent'work'80acd78aa4c25314'Server  'AjaxControlToolkit'ExtenderBase'ScriptObjectBuilder.cs:323
  AjaxControlToolkit.ExtenderControlBase.OnLoad(EventArgs e) in f:'TeamCity'buildAgent'work'80acd78aa4c25314'Server'AjaxControlToolkit'ExtenderBase'ExtenderControlBase.cs:305
  System.Web.UI.Control.LoadRecursive() +54
  System.Web.UI.Control.LoadRecursive() +145
  System.Web.UI.Control.LoadRecursive() +145
  System.Web.UI.Control.LoadRecursive() +145
  System.Web.UI.Control.LoadRecursive() +145
 System.Web.UI.Page.ProcessRequestMain(Boolean    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
如果标头中没有数据绑定表达式(<%# %>),则调用Page.Header.Databind()不会有任何作用。<%= ...%>是一个代码块,而不是数据绑定表达式。只需尝试将其更改为<%# ... %>即可。