jQuery in an ASP.net MVC application using Master Pages

前端 未结 3 1069
一个人的身影
一个人的身影 2021-01-31 06:00

I am trying to get simple jQuery to execute on my Content page with no luck below is what I am trying to do:



        
3条回答
  •  [愿得一人]
    2021-01-31 06:46

    It may be that the JQuery file can't be found, try this for the script reference:

    
    

    The Url.Content will build the correct path regardless of whether the app is running in the root or a sub-directory.

    Also, if you've installed the hot-fix for the JS intellisense, you can use this in addition to the above:

    <% if (false) { %>
        
        
    <% } %>
    

    Edit:

    Since the release of the RC 1 Refresh, there's been a know bug about placing elements with code blocks in the header, Philip Haacked has a nice article about solving it...

    Edit 2:

    Apparently this has been fixed since RC 2 was released...

    • Code nuggets that are direct children of the head element do not cause an exception if the runat="server" attribute is added to them.

    Edit 3:

    The hot-fix referenced earlier is only applicable to VS2008 and is available here - check out the blog post by the VS Web Dev Team here for details. VS2010 has it built in.

提交回复
热议问题