【发布时间】:2019-05-13 10:52:59
【问题描述】:
DatePicker 你好,我想用月份和年份替换这个日期选择器。在我的模型中,我有这段代码:
[Required]
[DataType(DataType.Date)]
[Display(Name = "Select Month")]
[DisplayFormat(DataFormatString = "{0:MM/yyyy}", ApplyFormatInEditMode = true)]
public Nullable<System.DateTime> Month { get; set; }
在我看来我有这个:
<div class="col-sm-9">
Current Month : <span>@Convert.ToDateTime(Model.Month).ToString("MMM-yyyy")</span>
@Html.EditorFor(model => (model.Month), new { htmlAttributes = new { @class = "form-control input-circle " } })
@Html.ValidationMessageFor(model => model.Month, "", new { @class = "text-danger " })
</div>
【问题讨论】:
-
您可以从文档中查看 minviewmode 选项。 bootstrap-datepicker.readthedocs.io/en/latest/…