Jquery Bootstrap 3日期选择器和.net
我一直在尝试将Datepicker合并到visual basic应用程序中。在文本框内单击时,我无法使日历弹出。我已经安装了Bootstrap 3,并下载了Bootstrap-datepicker.js和datepicker.css。bootstrap-datapicker.js位于my/Scripts文件夹中(与bootstrap.js、bootstrap.min.js和jquery-1/10.2*.js文件系列一起),datepicker.css位于my/Content文件夹中(与所有bootstrap*.css文件一起) 下面是我正在执行的代码。非常感谢您的帮助。 谢谢你,乔纳森Jquery Bootstrap 3日期选择器和.net,jquery,vb.net,twitter-bootstrap,datepicker,Jquery,Vb.net,Twitter Bootstrap,Datepicker,我一直在尝试将Datepicker合并到visual basic应用程序中。在文本框内单击时,我无法使日历弹出。我已经安装了Bootstrap 3,并下载了Bootstrap-datepicker.js和datepicker.css。bootstrap-datapicker.js位于my/Scripts文件夹中(与bootstrap.js、bootstrap.min.js和jquery-1/10.2*.js文件系列一起),datepicker.css位于my/Content文件夹中(与所有boo
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title id="titleTag"><%: Page.Title %> 401(k) Account</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<link runat="server" id="StyleLink1" rel="stylesheet" type="text/css" href="~/Content/Site_vsta.css" />
<link runat="server" id="Link1" rel="stylesheet" type="text/css" href="/Content/Site.css"/>
<link runat="server" id="Link2" rel="stylesheet" type="text/css" href="~/Content/datepicker.css" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<script src="Scripts/bootstrap-datepicker.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--Framework Scripts--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="jquery" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
<%--Site Scripts--%>
</Scripts>
</asp:ScriptManager>
<div class="container">
<asp:TextBox ID="DateTextbox" runat="server" CssClass="m-wrap span12 date form_datetime" ClientIDMode="Static"></asp:TextBox>
</div>
<script type="text/javascript">
$(document).ready(function () {
var dp = $('#<%=DateTextbox.ClientID%>');
dp.datepicker({
changeMonth: true,
changeYear: true,
format: "dd.mm.yyyy",
language: "tr"
}).on('changeDate', function (ev) {
$(this).blur();
$(this).datepicker('hide');
});
});
</script>
</form>
</body>
</html>
401(k)账户
$(文档).ready(函数(){
var dp=$(“#”);
日期选择器({
变化月:对,
变化年:是的,
格式:“dd.mm.yyyy”,
语言:“tr”
}).on('changeDate',功能(ev){
$(this.blur();
$(this.datepicker('hide');
});
});
将对bootstrap-datepicker.js的引用移动到
块下方。我在jQuery UI中遇到过类似的问题,最后删除了jQuery的
,并使用标准的
引用来修复它。我不知道asp:ScriptReference增加了什么价值。您可能还需要将对bootstrap-datepicker.js的引用移动到asp:ScriptManager下面。脚本加载的顺序很重要。在浏览器中使用F12查看是否有任何错误,并将其包含在问题中。尝试简化故障排除的引用以确定问题。将引用移动到scriptmanager下面的bootstrap-datepicker.js修复了我的问题。谢谢。我对细节的记忆不是很好,但我似乎记得需要使用moment.js或prettify.js才能使我的工作正常。