C# MVC4在aspx文件中集成jQuery日期选择器
我使用的是aspx文件,因为我的ReportViewer控件和来自asp:TextBox的jQuery日期选择器不会弹出 如何在文本框中显示日期选择器C# MVC4在aspx文件中集成jQuery日期选择器,c#,jquery,asp.net,asp.net-mvc,datepicker,C#,Jquery,Asp.net,Asp.net Mvc,Datepicker,我使用的是aspx文件,因为我的ReportViewer控件和来自asp:TextBox的jQuery日期选择器不会弹出 如何在文本框中显示日期选择器 <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownListAgenti" runat="server" DataTextField="nume" DataValueField="id_agent" Data
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownListAgenti" runat="server" DataTextField="nume" DataValueField="id_agent" DataSourceID="EntityDataSourceHelios" />
From <asp:TextBox ID="TextBoxFrom" Width="80" runat="server"></asp:TextBox>
To <asp:TextBox ID="TextBoxTo" Width="80" runat="server"></asp:TextBox>
<asp:Button ID="Display" runat="server" onclick="Display_Click" Text="Display" />
<rsweb:ReportViewer ID="ReportViewerAgentvanz" runat="server" Font-Names="Verdana" Font-Size="8pt" Width="800px" Height="800px" InteractiveDeviceInfos="(Collection)" />
<asp:ScriptManager ID="ScriptManagerAgentvanz" runat="server" />
<asp:EntityDataSource ID="EntityDataSourceHelios" runat="server" EnableFlattening="False"
ConnectionString="name=HeliosEntities" DefaultContainerName="HeliosEntities" EntitySetName="agenti"
Select="it.[id_agent], it.[nume]" OrderBy="it.nume ASC" Where="it.active = TRUE">
</asp:EntityDataSource>
</div>
</form>
要在文本框中显示jquery日期选择器,只需执行以下操作:
$(function () {
$("#TextBoxTo").datepicker();
$("#TextBoxFrom").datepicker();
});
现在,关于在剃刀页面中查看报告的问题,恐怕是不可能的。要查看报表,您需要ReportViewer
控件(您在代码中使用了该控件),并且不能在Razor中使用ASP.NET控件。您没有包括JQuery库、JQueryUI库或JQueryUI CSS文件
将此添加到文档的
:
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.20/themes/base/jquery-ui.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.8.20/jquery-ui.min.js" type="text/javascript"></script>
您没有包括JQuery库、JQueryUI库或JQueryUI CSS文件
将以下内容添加到文档的
<link rel="stylesheet" href="http://code.jquery.com/ui/1.8.20/themes/base/jquery-ui.css" type="text/css" media="all" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.8.20/jquery-ui.min.js" type="text/javascript"></script>
我们需要查看由ASPX页面生成的Javascript和HTML。我已经添加了一个指向HTML文件的链接。谢谢:)我在您的HTML中没有看到任何对jQuery的引用?它可能希望是$(“input[id$='TextBoxTo'])。datepicker();由于.net将为您生成一个不安静的id,因此执行上述操作意味着您希望对id以“TextboxTo”结尾的任何输入应用一个日期选择器@Steve Yeah good point,但是查看他生成的标记(他附加了一个HTML文件),id正好是TextboxTo
:)