eggy
eggy

Reputation: 2844

Use other stylesheet instead of App_Themes

I have an ASP website that is using App_Themes in the project.

Inside this website, I have merged another colleague's work who has been working on /colleague_work/. The new work has new styles independent of the App_Themes, namely /colleague_work/styles.css.

When I view the source of the site at /colleague_work/default.aspx, the App_Theme/Theme1/AppStyles.css is being injected to the page and is overwriting styles.

How do I swap the stylesheets, or disable the first stylesheet, without upsetting the rest of the website's styling from App_Themes? The colleague's stylesheets are not allowed to be moved from their location into the App_Themes folder.

File tree structure:

File tree structure example

Upvotes: 0

Views: 573

Answers (1)

eggy
eggy

Reputation: 2844

Within ASP.NET, attributes and elements take precedence in the following order (first to last):

  1. Theme attributes in the @ Page directive
  2. <pages theme="themeName"> elements in the <system.web> section of a web.config file
  3. Local control attributes
  4. StyleSheetTheme attributes in the @ Page directive
  5. <pages styleSheetTheme="themeName"> elements in a web.config file

One workaround would be to disable the themes for a specific page, by setting the EnableTheming attribute of the @ Page directive to false, while also referencing the styles.css with a <link> tag.

This is done before the <!DOCUTYPE> tag, and for the /colleague_work/default.aspx page, would look something like this:

<%@ Page Language="C#" EnableTheming="false" %>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
...
</html>

More information:

How to: Disable MSDN Themes

Upvotes: 1

Related Questions