日付を入力できる必要がありますが、MM/YYYYデータのみを受け入れることができるようにするにはjQueryMobiledatepickerが必要です。この問題のヘルプは素晴らしいでしょう。ありがとう。
これが私が持っているものです...
見る:
<h3>Search Dates</h3>
<div data-role="fieldcontain">
<div class="editor-label">
@Html.LabelFor(m => m.SearchBeginDate)
</div>
<div class="editor-field">
@Html.TextBoxFor(m => m.SearchBeginDate)
@Html.ValidationMessageFor(m => m.SearchBeginDate)
</div>
<div class="editor-label">
@Html.LabelFor(m => m.SearchEndDate)
</div>
<div class="editor-field">
@Html.EditorFor(m => m.SearchEndDate)
@Html.ValidationMessageFor(m => m.SearchEndDate)
</div>
<br />
</div>
モデル:
[Required]
[Display(Name = "Begin Date")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/yyyy}")]
public DateTime SearchBeginDate { get; set; }
[Required]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/yyyy}")]
[Display(Name = "End Date")]
public DateTime SearchEndDate { get; set; }