javascript - 无法修改 Controls 集合,因为该控件包含代码块(即 <% ... %>)。Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel

标签 javascript c# html asp.net telerik

The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +8668018
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +133

[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
   Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) +181
   Telerik.Web.UI.RadAjaxControl.PerformRender() +375
   Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) +1222
   Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) +95
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +256
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266

最佳答案

你也可以在不使用 telerik 的情况下遇到这个问题,所以更好的解决方案是添加一个

palceholder 而不是 RadCodeBlock 适合所有情况

    <asp:PlaceHolder ID="PlaceHolder1"
your script 

 runat="server"></asp:PlaceHolder>

关于javascript - 无法修改 Controls 集合,因为该控件包含代码块(即 <% ... %>)。Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22833685/

相关文章:

c# - 如何在 Sitecore 中获取项目属性/字段?

php - 将动态 html 放在页面上最可接受的方式

javascript - 使用 ExtJS 获取特定类型的所有元素

c# - 使用 TryParseExact 将 "August 2012"转换为 DateTime 对象

c# - 安装证书时模拟用户

javascript - 改变 Angular 指令添加的 CSS?

java - 在 Java 中合并 HTML 文件

javascript - 根据后面出现的所需项目数组对对象数组进行排序

javascript - VueJS v-bind 不适用于 kebab-case

javascript - 使用 php 数组生成选择选项