2016-07-27 93 views
1

我安裝了由Eondasdan Bootstrap.v3.Datetimepicker到我的MVC項目。MVC引導datetimepick不能正常工作

在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

我說這個要頂

@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呈現正確。即沒有顯示鼠標指針,而是一個普通的文本光標。時間圖標是左對齊的,而且當前選擇的日期也不顯示等。有什麼想法?

截圖:https://postimg.org/image/wamg3p43b/

+0

檢查本文HTTP ://www.brendanforster.com/blog/yet-another-implement-less-in-aspnetmvc-post.html – unique

+0

感謝提示,我使用NuGet切換到bootstrap datetimepicker的CSS版本,並修復了一切。 – rukiman

回答

1

你可能想嘗試添加實際的CSS文件,而用不到的文件

更換

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")); 
+0

據我所知,只有nuget安裝的文件較少。 – rukiman