* Razor - INPUTタグで日付を編集する [#e5109e20]

** Viewでフォーマットを指定する [#n566d507]
 @Html.TextBoxFor(m => m.Date, "{0:dd/MM/yyyy}", new { @class = "width-xx" })
** 参考 [#g2b0b990]
http://stackoverflow.com/questions/17602594/mvc-4-editorfor-textboxfor-and-date-field

** ViewModelでDisplayFormatアトリビュートを使う [#d65ed531]
*** ViewModel [#le0113a4]
 [Display(Name = "When was that document issued ?")]
 [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:d}")]
 public DateTime? LiquorLicenceDocumentIssueDate { get; set; }
*** View [#f0b9e6aa]
 @Html.EditorFor(m => m.LiquorLicenceDocumentIssueDate)

** 参考 [#h38d0dc5]
http://stackoverflow.com/questions/4679352/converting-datetime-format-using-razor/8362126#8362126


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS