views:

21

answers:

1

I have in my C#, .NET 3.5 (VS2008) web project's App_Themes directory a theme directory called Theme1. In that directory I have various other directories. Some of theme contain .css files and some contain .js files. In my web pages, which use this theme, the appropriate link tags are rendered, in the HTML, for the .css files, but not the .js files. What am I doing wrong, or do I simply have to share all my .js files across all themes from a centralised directory?

+1  A: 

If you place the JS files in your theme directory you can use the Page.Theme name to get the appropriate path for the current theme.

<script type="text/javascript" src="<%=ResolveUrl("~/App_Themes/" + Page.Theme + "/js/script.js") %>"></script>
Nathan Taylor
So, references to .js files are not include in the HTML by ASP.NET when they are placed inside theme directories?
Matt W
That is correct. You must individually specify what to load.
Nathan Taylor
This does make sense as you're likely to have site-wide and page-specific js
Basiclife