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

来源:互联网 发布:实时监测网速软件 编辑:程序博客网 时间:2024/05/16 18:54

http://stackoverflow.com/questions/22105833/how-do-i-add-placeholder-text-from-the-model-into-a-mvc-view

This solved my issue:

@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control input-sm", placeholder = @Html.DisplayNameFor(m=>m.Email) } })

The code that did it was

placeholder = @Html.DisplayNameFor(m=>m.Email) 

0 0