【发布时间】:2015-09-23 18:38:59
【问题描述】:
到目前为止,我有这个,它是只读的,但我希望它是灰色的。我需要它成为编辑器,因为我使用的是引导程序,它看起来比文本框更好。
@Html.EditorFor(model => model.EndDate, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
【问题讨论】:
-
我需要它成为 EditorFor?不,你不。
TextBoxFor()将生成 。它的 html 属性(@class = "form-control")决定了它的外观,可以使用TextBoxFor()轻松添加 -
你说得对,我使用 TextBoxFor() 并为其添加背景颜色。
标签: html model-view-controller views