好的,我有一些代码和快照来解释我的问题,
我有一个母版页Main.Master
,其中包含css
和jquery
的所有引用
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="CTVideos.Main" %>
<%@ Register Src="uc/LeftNav.ascx" TagName="LeftNav" TagPrefix="uc4" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta charset="UTF-8" />
<title>Video</title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<!-- Style Sheets -->
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/bootstrap.min.css") %>" />
<!-- Font Icons -->
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/font-awesome.min.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/ionicons.min.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/socicon-styles.css") %>" />
<!-- Font Icons -->
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/hover-min.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/owl.carousel.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/animate.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/css-menu.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/loader.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/styles.css") %>" />
<link rel="stylesheet" type="text/css" href="<%#ResolveUrl("~/css/responsive.css") %>" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body id="index-v2">
<form id="form1" runat="server">
<uc1:LeftNav runat="server" ID="LeftNav" />
<asp:ContentPlaceHolder ID="cpl_chlid" runat="server">
</asp:ContentPlaceHolder>
</form>
<!-- Scripts -->
<script src="<%#ResolveUrl("~/js/wow.min.js")%>"></script>
<script src="<%#ResolveUrl("~/js/jquery-1.12.3.min.js")%>"></script>
<script src="<%#ResolveUrl("~/js/bootstrap.min.js")%>"></script>
<script src="<%#ResolveUrl("~/js/owl.carousel.min.js")%>"></script>
<script src="<%#ResolveUrl("~/js/css-menu.js")%>"></script>
<script src="<%#ResolveUrl("~/js/jquery.validate.js")%>"></script>
<script src="<%#ResolveUrl("~/js/custom.js")%>"></script>
</body>
</html>
并在Main.Master
页面加载事件
public partial class Main : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
Page.Header.DataBind();
}
}
我项目的根目录就是那个
WebForm1
,WebForm2
和View文件夹中的其他WebForms都是从Main.Master
页面继承的。 WebForm1
,WebForm2
按预期正常加载,但View文件夹中的所有WebForms都未正确加载,设计受到干扰
答案 0 :(得分:2)
从所有css文件中删除ResolveUrl并简单地附加它们因为脚本只需要ResolveUrl。只需从css文件中删除ResolveUrl即可完美运行。
解决方案2 -
您可以在ResolveUrl
中将#
符号替换为=
实施例
<%# ResolveUrl("~/js/wow.min.js") %>
同
<%= ResolveUrl("~/js/wow.min.js") %>
解决方案2为我工作。