MVC Bootstrap datetimepick无法正常工作 [英] MVC Bootstrap datetimepick not working correctly
问题描述
我将Eondasdan的Bootstrap.v3.Datetimepicker安装到了我的MVC项目中.
I installed the Bootstrap.v3.Datetimepicker by Eondasdan into my MVC project.
在BundleConfig.cs中
In BundleConfig.cs
bundles.Add(new ScriptBundle("~/bundles/datepicker").Include(
"~/Scripts/moment.min.js",
"~/Scripts/bootstrap-datetimepicker.min.js"));
bundles.Add(new StyleBundle("~/Content/datepicker").Include(
"~/Content/_bootstrap-datetimepicker.less",
"~/Content/bootstrap-datetimepicker-build.less"));
在_Layout.cshtml
In _Layout.cshtml
我将此添加到顶部
@Styles.Render("~/Content/datepicker")
这是最底下的
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/foolproof")
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/bundles/datepicker")
cshtml有这个
<div class="form-group">
@Html.LabelFor(m => m.NewMeeting.EndTime, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.TextBoxFor(m => m.NewMeeting.EndTime, new { @class = "datetimepicker form-control" })
</div>
</div>
但是看到屏幕截图,我认为我的datetimepicker无法正确显示.也就是说,没有显示鼠标指针,而是普通的文本光标.时间图标保持左对齐,并且当前选择的日期也未显示,等等.有什么想法吗?
However see screenshot, I don't think my datetimepicker is rendered correctly. I.e the mouse pointer is not shown instead it is a normal text cursor. The time icon is left aligned and also the currently selected date is not shown etc. Any ideas?
截屏: https://postimg.org/image/wamg3p43b/
推荐答案
您可能想尝试添加实际的CSS文件,而不是添加LESS文件
You might want to try to add the actual CSS files rather than the LESS files
替换
bundles.Add(new StyleBundle("~/Content/datepicker").Include(
"~/Content/_bootstrap-datetimepicker.less",
"~/Content/bootstrap-datetimepicker-build.less"));
与
bundles.Add(new StyleBundle("~/Content/datepicker").Include(
"~/Content/bootstrap-datetimepicker.css"));
这篇关于MVC Bootstrap datetimepick无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!