无法修改控件集合,因为控件包含代码块(即 <% .. %>).Telerik.Web.UI.RadAjaxControl
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel
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>
如果您在
页面中使用了"<%= %> 或 <%# %>",则需要使用 RadcodeBlock
.
例:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
//your script
</telerik:RadCodeBlock>
就我而言,我在ASPX页面中几乎没有if-else块,如下所示。
<%if (showControl)
{%>
<%--HTML Markup--%>
<%}%>
我把每个都包在一个RadCodeBlock
里,错误就消失了。
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<%if (showControl)
{%>
<%--HTML Markup--%>
<%} %>
</telerik:RadCodeBlock>
必须将每个这样的块包装在RadCodeBlock中。尝试包装整个 html 正文,但这不起作用。
相关文章:
- 音频控件在mouseover上显示,在mouseout上淡出
- 后焦点更改为IE 11中的地址栏,而不是转移到表单中的下一个控件
- 如何在读取XLS/XLSX本地文件时,使用IE的javascript代码启用未标记为安全的ActiveX控件
- Windows形成web浏览器控件和Javascript更改的DOM
- 如何将javascript事件从web浏览器wpf控件发送到wpf的c#代码
- 如何更改文本框控件的不透明度值
- 所有控件的组合框
- 创建一个方法,通过一个窗口进行迭代并获取Titanium中的所有控件
- 在angularjs中创建自定义控件的推荐方法
- 自定义控件中的双向绑定在SAPUI5中不起作用
- 如何在ASP中为用户控件添加Javascript对象网
- Dynamics 2016内部部署Crm客户端脚本.选项集控件类型缺少方法
- 从服务器获取数据并在选择控件中使用ng选项无法显示选项
- 如何设置Telerik RadUpload控件的默认工具提示
- 在 HTML 页面中添加 Telerik 网格控件
- 使用ASP.net控件禁用表&Telerik控制
- ASP.NET Telerik控件的jQuery样式
- 错误的定时问题,Telerik RadEditor控件's客户端事件和jquery's on page
- 使用ASP.NET和Telerik's Ajax rad控件
- 无法修改控件集合,因为控件包含代码块(即 <% .. %>).Telerik.Web.UI.RadAjaxControl