2014-03-04 24 views
0

我有一個webform頁面,它使用包含多個腳本引用的母版頁。對於這個特定的頁面,我有兩個引用其他java腳本footable.js和footable.striping.js的項目。 名爲calandar1old.aspx的webform位於根目錄下,並使用這兩個腳本文件正常運行。我得到一個交替行高亮的響應式網格視圖。asp.net「Scriptreference Path」設置不起作用

如果我從根目錄下創建幾個相同的webform目錄,頁面將會加載,但腳本(footable.js和footable.striping.js)不會運行。腳本應該創建一個響應式網格視圖和交替行高亮。我試圖改變在/JML/Infoleague/Calandar1.aspx文件的路徑參考如下:

<asp:ScriptReference Path="js-foo/footable.js" /> 
<asp:ScriptReference Path="~/jml/infoleague/js-foo/footable.js" /> 
<asp:ScriptReference Path="./jml/infoleague/js-foo/footable.js" /> 
<asp:ScriptReference Path="../../js-foo/footable.js" /> 

這裏是從主文件中的相關信息:

<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="SiteMenuHeader.Master.vb" Inherits="CoWorkerTestJML.SiteMenuHeader" %> 

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 

<head runat="server"> 
<asp:ContentPlaceHolder ID="head" runat="server"> 
</asp:ContentPlaceHolder> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<asp:ContentPlaceHolder ID="head" runat="server"> 
</asp:ContentPlaceHolder> 

<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<meta name="author" content="SemiColonWeb" /> 


<!-- ============================================ 
    Stylesheets 
============================================= --> 
<link href="http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic|Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" /> 
<link rel="stylesheet" href="style.css" type="text/css" /> 
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)" type="text/css" href="css/retina.css" /> 
<link rel="stylesheet" href="css/colors.php" type="text/css" /> 
<link rel="stylesheet" href="css/tipsy.css" type="text/css" /> 
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" /> 
<link rel="stylesheet" href="css/font-awesome.css" type="text/css" /> 
<link rel="stylesheet" href="css/animate.css" type="text/css" /> 
<link rel="stylesheet" href="css/magnific-popup.css" type="text/css" /> 
<link rel="stylesheet" href="css/ls/css/layerslider.css" type="text/css" /> 
<link rel="stylesheet" href="css/responsive.css" type="text/css" /> 
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
<!--[if lt IE 9]> 
    <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
<![endif]--> 


<!-- ============================================ 
    External JavaScripts 
============================================= --> 
<script type="text/javascript" src="js/jquery.js"></script> 
<script type="text/javascript" src="js/greensock.js"></script> 
<script type="text/javascript" src="js/plugins.js"></script> 
<script type="text/javascript" src="js/layerslider.transitions.js"></script> 
<script type="text/javascript" src="js/jquery.layerslider.js"></script> 

下面是從相關信息/JML/Infoleague/Calandar1.aspx文件:

<%@ Page Language="vb" MasterPageFile="~/SiteMenuHeader.Master" AutoEventWireup="false" CodeBehind="Calandar1.aspx.vb" Inherits="CoWorkerTestJML.JML_InfoLeague_Calandar1"%> 

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> 
<meta name="viewport" content = "width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no" /> 

<link rel="stylesheet" href="css-foo/footable.core.css" type="text/css" /> 

</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"> 
<Scripts> 
<asp:ScriptReference Path="../../js-foo/footable.js" /> 
<asp:ScriptReference Path="js-foo/footable.striping.js" /> 
</Scripts> 

我幾乎肯定有一個路徑問題。我錯過了什麼?

回答

0

你可以嘗試使用以下路徑

<asp:ScriptReference Path="/js-foo/footable.js" /> 

...其中所代表的路徑是從站點的根目錄。 您也可以對每個CSS路徑執行相同的操作。

+0

這是行不通的。與以前相同的結果。 – user2150574