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?
views:
21answers:
1
+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
2010-08-13 10:00:53
So, references to .js files are not include in the HTML by ASP.NET when they are placed inside theme directories?
Matt W
2010-08-13 10:02:47
That is correct. You must individually specify what to load.
Nathan Taylor
2010-08-13 14:10:19
This does make sense as you're likely to have site-wide and page-specific js
Basiclife
2010-08-13 16:02:42