【发布时间】:2015-06-29 18:27:19
【问题描述】:
我正试图让日期选择器在我的 asp 网站上工作。已经制作了一个预订页面,我想在其中使用两个日期选择器来办理入住和退房。
它在视觉上可以正常工作,因此 css 可以正常工作,但是当您单击图标或文本框时,什么也没有发生。
预订代码.aspx:
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div class="container">
<div class="row">
<div class='col-sm-6'>
<div class="headline">
<h3>BOOKING</h3>
<hr />
</div>
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker2').datetimepicker({
locale: 'ru'
});
});
</script>
</div>
</div>
</asp:Content>
已在 Visual Studio 中通过 NuGet 安装“Bootstrap 3 datetimepicker”和“Bootstrap 3 datetimepicker”
我的头html代码在哪里导入了js和css:
<html lang="en">
<head runat="server">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><%: Page.Title %> - M-Hotels</title>
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/modernizr") %>
</asp:PlaceHolder>
<!-- Fonts -->
<link href='http://fonts.googleapis.com/css?family=Lato:100,300' rel='stylesheet' type='text/css'>
<!-- CSS Files -->
<link href="Content/bootstrap.css" rel="stylesheet" />
<link href="Content/font-awesome.css" rel="stylesheet" />
<link href="Content/bootstrap-datetimepicker.css" rel="stylesheet" />
<link href="Content/Site.css" rel="stylesheet" />
<!-- js Files -->
<script src="Scripts/jquery-1.10.2.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<script src="Scripts/bootstrap-datetimepicker.js"></script>
<script src="Scripts/bootstrap-datetimepicker.min.js"></script>
<script src="Scripts/moment.js"></script>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form runat="server">
<asp:ScriptManager runat="server">
<Scripts>
<%--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>
在这里阅读了其他帖子,他们建议将链接移动到 js,但没有一个有效。
如何通过 NuGet 安装它的安装页面在这里找到:http://eonasdan.github.io/bootstrap-datetimepicker/Installing/#nuget
谁能看出问题出在哪里?
【问题讨论】:
-
你为什么要把
div变成日期选择器而不是input? -
@mason 插件页面上的演示使用
div包装了input。 eonasdan.github.io/bootstrap-datetimepicker -
@ShaunLuttin 对我来说没有意义。我不会使用像那样打破范式的东西。任何类型的可选输入都应该是
<input>元素。<div>没有理由让您选择日期。 -
@mason
div正在包装input。这就是 bootstrap 使用的范例:getbootstrap.com/css/#forms-example 在页面中搜索 input-group,您会看到该范例 11 次。 -
@ShaunLuttin 您误解了 Bootstrap 范式。 div 不打算用作 Bootstrap 中的输入,它应该将一组处理输入的元素组合在一起。
标签: javascript asp.net twitter-bootstrap