How do I add placeholder text from the model into a MVC view?

后端 未结 9 1267
余生分开走
余生分开走 2021-02-05 12:43

I have a model:

[DataType(DataType.EmailAddress)]
[DisplayFormat(ConvertEmptyStringToNull = true)]
[Display(Prompt = \"Email Address\")]
public string Email { ge         


        
9条回答
  •  半阙折子戏
    2021-02-05 13:23

    Check out this answers to this question, which has been answered aleady (a few times).

    • Html attributes for EditorFor() in ASP.NET MVC
    • ASP.NET MVC 3 Razor - Adding class to EditorFor

    @Html.EditorFor uses templates, and so the approach to this problem is using a customised template.

提交回复
热议问题