jQuery DatePicker MVC4 EditorFor

后端 未结 3 919
盖世英雄少女心
盖世英雄少女心 2021-01-02 10:17

I need to use datepicker on an EditorFor field.

My code for the view is:

@Html.Label(\"birthDate\",\"birthDate
3条回答
  •  悲&欢浪女
    2021-01-02 10:43

    I had a simmilar issue, solved by using the HTML5 functionality, that has support for datetime, in your example I would suggest trying somthing like this:

    @Html.Label("birthDate","birthDate")
    @Html.EditorFor(model => model.birthDate, new { @class = "datepicker", type="datetime-local"}) @Html.ValidationMessageFor(model => model.birthDate)

    the only thing that I addes is a type ="datetime-local"

提交回复
热议问题