使用 SquishIt 并获取“无法修改控件集合,因为控件包含代码块”错误

发布于 2024-12-20 03:47:38 字数 1765 浏览 2 评论 0原文

我正在编写一个 .net 2.0 网站项目,并且很高兴使用 SquishIt 一段时间来通过 CSS 和 Javascript 进行缩小和组合。我最近开始收到此错误:

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) +11035338
   Telerik.Web.SkinRegistrar.RegisterCssReference(Page _page, Control _control, String _url) +413

[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
   Telerik.Web.SkinRegistrar.RegisterCssReference(Page _page, Control _control, String _url) +533
   Telerik.Web.SkinRegistrar.RegisterCssReferences(ISkinnableControl _control) +828
   Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +32
   System.Web.UI.Control.PreRenderRecursiveInternal() +108
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394

如您所见,我们也在网站内使用 Telerik 控件,因此我怀疑这就是问题所在。

我尝试使用 SquishIt API 从后面的代码调用添加和渲染命令,但它根本没有产生任何结果。

有什么想法吗?我不想放弃 SquishIt,因为它在其他方面表现得很好。

I am writing a .net 2.0 website project and had been happily using SquishIt for some time to minify and combine by CSS and Javascript. I recently starting getting this error :

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) +11035338
   Telerik.Web.SkinRegistrar.RegisterCssReference(Page _page, Control _control, String _url) +413

[HttpException (0x80004005): Please, see whether wrapping the code block, generating the exception, within RadCodeBlock resolves the error.]
   Telerik.Web.SkinRegistrar.RegisterCssReference(Page _page, Control _control, String _url) +533
   Telerik.Web.SkinRegistrar.RegisterCssReferences(ISkinnableControl _control) +828
   Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e) +32
   System.Web.UI.Control.PreRenderRecursiveInternal() +108
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394

As you can see we are also using Telerik controls within the site so I suspect this is the issue.

I tried using the SquishIt API to call the Add and Render commands from code behind but it didn't produce any results at all.

Any ideas? I'd rather not abandon SquishIt as it performs great otherwise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你没皮卡萌 2024-12-27 03:47:38

我找到了解决方案。事实证明,当您在站点中使用 Telerik Rad 控件时,如果母版页的标题中有任何代码块,那么您需要包含一个特殊的 Telerik 代码块标记

有了这个标签,我现在可以毫无错误地使用 SquishIt!

I found the solution. It turns out that when you are using Telerik Rad controls within your site and if you have any code blocks in the header of your master pages then you need to include a special Telerik code block tag.

With this tag in place I can now use SquishIt without error!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文