开发者

Prevent ASP.NET themes from auto-adding CSS files

Having to deal with URL rewriting, I decided to programmatically add CSS references rather than relying on the automatic behavior of ASP.NET to add all CSS files within a theme automatically to the <head> of an ASPX page.

I suceeded in adding the CSS file programmatically by using

<link type="text/css" rel="stylesheet" runat="server" id="CssFile" />

and setting the actual URL it in code behind.

My question is:

Is there a way to prevent the ASP.NET "engine" from automatically adding all CSS files into the <head> of my ASPX/master page?

(Of co开发者_Python百科urse, I still could go with my own folders and completely drop the App_Themes concept)


You can prevent this feature by adding the following attributes to the Page directive:

<%@ Page ... EnableTheming="false" Theme="" StylesheetTheme="" %>


I do not believe you can tell a skin to not include the files within it, that was the killer for us when it came to using them as it referenced all the css files not just the ones we needed and we needed maximum efficiency.


<head runat="server" visible="false" />


<%@ Master Language="C#" AutoEventWireup="true" Inherits="Front" Codebehind="Front.master.cs" **EnableTheming="false"** %>
was my solution to getting around the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜