我有一个应用程序MVC 4,遗憾的是我需要放几个aspx web表单才能使用ReportViewerControl ......
我的问题是 尝试将MasterPage用于这些aspx Web表单时,jquery停止了工作。
这是masterPage代码
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterAspx.master.cs" Inherits="GestioneMovimentazioni.MasterAspx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="Content/Site.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.10.3.custom.js" type="text/javascript"></script>
<link href="Content/themes/red_green_white/jquery-ui-1.10.3.custom.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.ui.datepicker-it.js"></script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="div_header" class="div_header">
<div class="float-left">
<img src="~/Images/img_sx_r.png" />
</div>
<div id="page_title" class="float-left div_header_page_title" >
</div>
<div class="float-right">
<img src="~/Images/img_dx_r.png" />
</div>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" >
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
这是表格
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAspx.Master" AutoEventWireup="true" CodeBehind="BilCom.aspx.cs" Inherits="GestioneMovimentazioni.BilCom" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
$(document).ready(function () {
$('#txtDate').datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'MM yy',
onClose: function (dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
}
});
});
</script>
<style>
.ui-datepicker-calendar {
display: none;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="div_display_table">
<div class="div_display_table_row">
<div class="div_display_table_cell">
<label id="label_data_filter">Mese</label>
</div>
<div class="div_display_table_cell">
<label id="label1">Calcola</label>
</div>
</div>
<div class="div_display_table_row">
<div class="div_display_table_cell">
<asp:TextBox ID="txtDate" runat="server" class="input_add w_80"></asp:TextBox>
</div>
<div class="div_display_table_cell">
<asp:ImageButton ID="btnCalcola" runat="server" ImageUrl="~/Images/calcola.png" />
</div>
</div>
</div>
<div>
<asp:ScriptManager ID="ScriptManager2" runat="server" />
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="900px" Height="650px"
Font-Names="Calibri" Font-Size="8pt" WaitMessageFont-Names="Calibri"
WaitMessageFont-Size="14pt">
</rsweb:ReportViewer>
</div>
</asp:Content>
你能帮我理解为什么datepicker已经停止工作了吗? 谢谢!
答案 0 :(得分:1)
您需要将asp文本框的属性“ ClientIDMode ”设置为“静态”