且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Html.EditorFor中使用占位符属性?

更新时间:2023-11-25 08:38:28

升级到MVC 5.1,你可以在EditorFor中使用HTML属性:

Upgrade to MVC 5.1 and you can use HTML attributes in EditorFor:

@Html.EditorFor(m => m.variable, new { htmlAttributes = new { placeholder = "Your Placeholder Text" } })

http://www.asp.net/mvc/overview/releases/mvc51-release-备注