Asp. NET master page references external JS or CSS file invalid, prompt object undefined workaround

Source: Internet
Author: User

Recently made a Web site with a JS+CSS implementation of a two-level menu navigation bar, after the master page was created, the child page calls a lot of strange problems, the final solution after the multi-verification and everyone to share the next ....

1. Path issues

If this file path is called by a separate ASPX page, it will be

1 <link type="text/css" rel="stylesheet" href= " Navigator/css/shou.css " />2 <script type="text/javascript" src= " Navigator/js/dropdown.js "

Pages that reference the master page this makes an error, cannot find the JS or CSS file, or prompts an object, the function is undefined

Make sure that the master Page

<asp:content id= "Content1" contentplaceholderid= "Head" runat= "Server"/> Add an external CSS style or JS file on the sub-page

1<link type="Text/css"Rel="stylesheet"href="<%=page.resolveclienturl ("~/navigator/css/shou.css")%>"/>2<script type="Text/javascript"Src="<%=page.resolveclienturl ("~/navigator/js/dropdown.js")%>"></script>

This will resolve the JS, CSS file that cannot find the external reference

Asp. NET master page references external JS or CSS file invalid, prompt object undefined workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.