My JS works when I reference it in the MasterPage, and it works when I reference it in a Partial View (.ascx
), but not when I reference from the View (.aspx
).
Any ideas why?
Is the path to the script file correct in your View?
If you inspect HTTP traffic with something like Fiddler or Firebug's Net tab, do you see your script resources being downloaded to the browser?
You might want to use UrlHelper.Content
and the relative path to render the script source in the page or perhaps create a HtmlHelper
extension method to render out a script tag for you (I think one exists in MVCContrib if you're using that already).