Reputation: 42185
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?
Upvotes: 1
Views: 546
Reputation: 125518
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).
Upvotes: 2
Reputation: 16035
So if you have a block declared in an included file (let's just pretend it looks like)
function alertMe(someValue) {
alert(somevalue);
}
and in your master page, aspx, and ascx you have
<script type="text/javascript">
alertMe("some string");
</script>
and it works in the master page and the ascx but not the aspx?
Upvotes: 0