[英]UserControl calling JS-files but they don't seem to get called
I have a usercontrol, which I created in VisualStudio2010. 我有一个在VisualStudio2010中创建的用户控件。 It calls some js-files like this : 它像这样调用一些js文件:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="SearchBox.ascx.vb" Inherits="NoVaCWWW.SearchBox" %>
<script type="text/javascript" src="../js/jquery.ui.datepicker-fr.js"></script>
<script type="text/javascript" src="../js/jquery.ui.datepicker-nl-BE.js"></script>
<script type="text/javascript" src="../js/SearchPanel.js"></script>
<script src="../js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<script src="../js/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="../js/jquery-1.6.4.min.js" type="text/javascript"></script>
On a page where this usercontrol isn't used (and which calls the same scripts) everything works fine. 在不使用此用户控件的页面上(该页面调用相同的脚本),一切正常。 This is: I have a date which is a jquery-ui-datepicker, and it works fine : 这是:我有一个日期,它是一个jquery-ui-datepicker,它可以正常工作:
<asp:Content ID="cntHeader" runat="server" ContentPlaceHolderID="ContentPlaceHolderHeader">
<script type="text/javascript" src="js/SearchPanel.js"></script>
<script type="text/javascript">
var fromDate = $.datepicker.parseDate('yy-mm-dd', $("#<%= txtFromDate.ClientID %>").val());
$(".needs-datepicker").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: '<%= Master.DateFormatJS %>',
altFormat: 'yy-mm-dd'
});
//Map the hidden fields containing the same date but in a computer friendly format
$("#txtFromDateF").datepicker("option", "altField", "#<%= txtFromDate.ClientID %>");
//And make sure that dates are being shown in the visible fields
$("#txtFromDateF").datepicker('setDate', fromDate);
On a page that has the usercontrol, it doesn't work. 在具有用户控件的页面上,它不起作用。 I don't get a datepicker. 我没有日期选择器。 This is the usercontrol's script : 这是usercontrol的脚本:
<script type="text/javascript" src="../js/SearchPanel.js"></script>
<script type="text/javascript">
<!--
$(function () {
$("#txtFromDateF").datepicker();
$("#txtToDateF").datepicker();
$(".needs-3mdatepicker").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy',
altFormat: 'yy-mm-dd',
maxDate: '+6m',
minDate: '-3m'
});
$(".needs-datepicker").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-yy',
altFormat: 'yy-mm-dd',
maxDate: '+6m'
});
$("#btnSearchCiNumber")
.button({
icons: {
primary: 'ui-icon-search'
},
label: $("#<%= SearchButton.ClientID %>").val()
})
.click(function () {
$("#<%= SearchButton.ClientID %>").click();
});
});
function btnSearchCiNumber_onclick() {
}
//-->
</script>
Can anyone help me? 谁能帮我?
I solved my problem by removing the files from the IIS-Server and then reinstalling the webapplication. 我通过从IIS服务器中删除文件然后重新安装Web应用程序解决了我的问题。 Now everything works fine. 现在一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.