Differences between Html.TextboxFor and Html.EditorFor in MVC and Razor

前端 未结 5 774
忘了有多久
忘了有多久 2020-11-27 10:24

Why by default were these changed when adding a new \"edit\" view? What are advantages when using EditorFor() vs. TextboxFor()?

I found thi

5条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 10:40

    The Html.TextboxFor always creates a textbox ().

    While the EditorFor looks at the type and meta information, and can render another control or a template you supply.

    For example for DateTime properties you can create a template that uses the jQuery DatePicker.

提交回复
热议问题