2

I am trying to put in some optimization into my application by using BundlesCollection in my ASP.Net 4.0 application.

My style bundle contains 6 css files. The files are included into a master page. If I remove the CSS files from master page and instead put following:

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

I am getting following error:

The Controls collection cannot be modified because the control contains code 
    blocks (i.e. <% ... %>).
TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
  • 1
    There's a control for rendering bundles in webforms, just get the webforms optimization package from nuget: – Rafe Apr 03 '14 at 19:09

1 Answers1

5

start the code block with <%# instead of <%=

Cris
  • 12,799
  • 5
  • 35
  • 50