是否有可能使Html.EditorFor变灰?

时间:2015-09-23 18:38:59

标签: html model-view-controller views

到目前为止,我有这个,它是readonly,但我希望它是灰色的。我需要它成为一个编辑器,因为我使用的是bootstrap,它看起来比文本框更好。

@Html.EditorFor(model => model.EndDate, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })

1 个答案:

答案 0 :(得分:1)

你可以使用TextBoxFor,你只需要重写一下:

    @Html.TextBoxFor(model => model.EndDate, new { @class = "form-control", @readonly = "readonly" })

这样就可以添加form-control类。

相关问题