What's the difference between these approaches to reference bundled CSS in ASP.NET Web Forms 4.5?
The <%: Styles.Render %>
syntax is for ASP.NET MVC (which can't use ASP.NET Controls as there is no real page context for them to use). The BundleReference
Control is for WebForms.
ASP.NET MVC can use WebForms as a view engine as an alternative to Razor (where you see too many '@' symbols), that's why there's a bit of crossover.
I imagine they added the Control to keep things consistent, rather than requiring WebForms folks to use the page's render function (the <%
tags).
When I look at the rendered page, the result appears to be the same thing. What is the difference between using webopt:BundleReference and using Styles.Render?
As understand it, the BundleReference is used not only for including script and style references, but for bundling them together for efficiency of bandwidth. See the tutorial Bundling and Minification. I think the latter is just a helper for including one or more scripts that fit URL pattern.