Display a formatted date in a TextBoxFor()

前端 未结 6 1730
长情又很酷
长情又很酷 2020-12-04 18:52

I\'m using MVC4 and Entity Framework to develop an intranet web app. I have a list of persons which I can edit. When I access the edit view, in the textbox \"Start date\", t

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 19:45

    Html.EditorFor also work


    @Html.EditorFor(model => model.StartDate, new { htmlAttributes = new { @class = "datepicker", @Value = model.StartDate.ToString("yyyy/MM/dd") } })
    

提交回复
热议问题