Uwe Keim
Uwe Keim

Reputation: 40736

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 course, I still could go with my own folders and completely drop the App_Themes concept)

Upvotes: 3

Views: 4450

Answers (4)

user1620050
user1620050

Reputation: 211

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

Upvotes: -1

SamFlushing
SamFlushing

Reputation: 97

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

Upvotes: 0

poklacsek
poklacsek

Reputation: 101

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

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

Upvotes: 8

mikelomaxxx14
mikelomaxxx14

Reputation: 143

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.

Upvotes: 4

Related Questions