2

我试图把一些优化到我的应用程序在我的ASP.Net 4.0应用程序中使用BundlesCollection使用捆绑(从Systelm.Web.Optimization)在ASP.Net Web窗体导致问题

我的样式包包含6个CSS文件。这些文件包含在母版页中。如果我从母版页删除CSS文件,而是把以下内容:

<%= Styles.Render("~/bundles/css/default") %> 

我收到以下错误:

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

有一个控制开始的代码块在webforms中渲染包,只需从nuget获取webforms优化包: Rafe 2014-04-03 19:09:44

回答

5

<%#代替<%=

+1

你的岩石,像一个魅力工作! – TheVillageIdiot 2013-03-12 05:45:25