Limit JavaScript and CSS files on ASP.NET MVC 2 Master Page based on Model and View content
- by Zack Peterson
I want to include certain .js and .css files only on pages that need them.
For example, my EditorTemplate DateTime.ascx needs files anytimec.js and anytimec.css.
That template is applied whenever I use either the EditorFor or EditorForModel helper methods in a view for a model with a DateTime type value.
I've put this condition into the…