2016-09-22 1 views
1

ASP.NET 웹 폼에 Loading.ascx라는 사용자 정의 컨트롤이 있습니다.이 템플릿은 페이지 중앙에 .gif 만 포함하고 있습니다. 사용자가 페이지의 아무 단추 나 링크를 클릭하면로드 이미지를 표시하는 데 사용됩니다.JQuery Datepicker는 사용자 정의 컨트롤이있는 동일한 웹 양식에서 작동하지 않습니까?

페이지에는 JQuery Datepicker에 링크 된 asp : TextBox도 있습니다.

catch되지 않은 형식 오류 : 프로그램을 실행하는 동안, 나는 다음과 같은 오류 얻을 처음에 내가 스택 오버플로에서 몇 가지 조사를했다 정의되지 않은

의 특성 'setdefaults를'을 읽을 수 없습니다,하지만 솔루션 중 누구도 나를 위해 일하지 않는다. 등록의 Src = "~/공통/Loading.ascx"태그 이름 = "LoadingScreen"TagPrefix = "UC"@

<퍼센트 %> : 어떤 임의의 일을하는 동안, 나는 영문 페이지에서 등록하는 .ascx 명령을 제거

datepicker에는 아무런 문제가 없습니다. 모든 문제가 해결되었습니다. 누구든지 내가 .ascx 파일을 JQuery Datepicker와 함께 사용하려고 할 때 잘못된 점을 이해하도록 도와 줄 수 있습니까? 다음은

아래는
> <%@ Control Language="vb" AutoEventWireup="false" 
> CodeBehind="Loading.ascx.vb" Inherits="eLearnWebRole.Loading" %> 
> <script 
> src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" 
> type="text/javascript"></script> 
> 
> <style> #divLoading{ 
>  display: none; 
>  width: 100%; 
>  background-color: rgba(255,246,246,0.5); 
>  top: 0px; 
>  left: 0px; 
>  position: absolute; 
>  text-align: center; 
>  vertical-align: middle; 
>  z-index: 99999; } 
>  #divLoadingImage{ 
>  position: absolute; 
>  display: block; 
>  width: 200px; 
>  height: 200px; } 
> 
> </style> 
> 
> <div id="divLoading"> <div id="divLoadingImage"> 
>  <asp:Image ID="imgLoading" AlternateText="LoadMsg" ImageUrl="~/Common/Images/Loading.gif" runat="server" /> </div> 
> </div> 
> 
> <script> $(document).ready(function() { 
> 
>  $("#divLoadingImage").css({ 
>   "left": (($(window).width() - $("#divLoadingImage").width())/2) + "px", 
>   "top": (($(window).height() - $("#divLoadingImage").height())/2) + "px" 
>  }); 
> 
>  $("#divLoading").height($(document).height()); 
> 
>  $(window).resize(function() { 
>   $("#divLoading").height($(window).height()); 
> 
>   $("#divLoadingImage").css({ 
>    "left": (($(window).width() - $("#divLoadingImage").width())/2) + "px", 
>    "top": (($(window).height() - $("#divLoadingImage").height())/2) + "px" 
>   }); 
>  }); 
> 
> }); </script> 

이 등록하는 .ascx 코드했다 영문 코드의 조각이다, Loading.ascx의 코드입니다 : 아래

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="StudentActivityReport.aspx.vb" Inherits="eLearnWebRole.StudentActivityReport" %> 

<%--Cannot use Loading.ascx with pages that have datepicker. Have to find an alternative to use both loading.ascx and datepicker in the same page--%> 
<%--<%@ Register Src="~/Common/Loading.ascx" TagName="LoadingScreen" TagPrefix="UC" %>--%> 

<!DOCTYPE html> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title>Page Title goes here</title> 
    <link rel="stylesheet" href="Style/jquery-ui.min.css" /> 
    <link rel="stylesheet" href="Style/jquery-ui.theme.min.css" /> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 

    <script src="Script/jquery-ui.min.js"></script> 

</head> 

<body> 
    <form id="form1" runat="server"> 
. 
. 
. 
. 
        <asp:RadioButton ID="rdoViewFrom" Value="Between" GroupName="rdogroupWeeklyOrViewFrom" AutoPostBack="true" runat="server"></asp:RadioButton>View From: 
        <asp:TextBox ID="txtCalFromDate" runat="server" AutoPostBack="true"></asp:TextBox> 
        To: 
        <asp:TextBox ID="txtCalToDate" runat="server" AutoPostBack="true"></asp:TextBox> 
. 
. 
. 
. 
</form> 
</body> 
</html> 

을의 .js 파일입니다 기본값을 datepicker로 설정하는 중에 오류가 발생했습니다.

$(document).ready(function() { 
. 
. 
. 
. 
    $.datepicker.setDefaults({ //Throws an error here. 
     changeMonth: true, 
     changeYear: true, 
     dateFormat: "dd/mm/yy", 
     defaultDate: new Date(), 
     firstDay: 1, 
     nextText: "Next", 
     prevText: "Prev", 
     showAnim: "fold", 
     showOn: "focus" 
    }); 
. 
. 
. 

}); 

감사합니다.

+0

시도 이동 – Webruster

답변

0
  1. 당신은 이미 이 UserControl을 호출하는 영문 페이지를 참조 으로 해당 UserControl에서 다시 Jquery 파일을 추가 할 필요가 없습니다.

  2. 시도는 $("#divLoadingImage").css() 영문 페이지에 영문 페이지에 UserControl을 작성했다`js`를로드

관련 문제