[DataType(DataType.Time)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:hh:mm tt}")]
[Display(Name = "TimeOfDrAvailablity")]
public System.DateTime TimeOfDrAvailablity { get; set; }
創建視圖
<p>
<input class="disableTimeRangesExample" type="text" autocomplete="off"></p>
<script type="text/javascript">
$(function() {
$('.disableTimeRangesExample').timepicker({
'disableTimeRanges': [
['1am', '2am'],
['3am', '4:01am']
]
});
});
</script>
我不知道我在哪裏wrong..please提出任何幫助... 我嘗試下面的教程.. http://jonthornton.github.io/jquery-timepicker/ 還告訴我如何使用模型
<div class="form-group">
@Html.LabelFor((model => model.TimeOfDrAvailablity),
new { @class = "col-sm-2 control-label" })
@Html.EditorFor((model => model.TimeOfDrAvailablity),
new { @class = "disableTimeRangesExample", type = "date" })
@Html.ValidationMessageFor(model => model.TimeOfDrAvailablity)
</div>