是否可以使 Html.EditorFor 变灰?
Is it possible to make an Html.EditorFor greyed out?
目前我有这个,它是只读的,但我希望它显示为灰色。我需要它作为一个 editorFor 因为我正在使用 bootstrap 并且它看起来比文本框更好。
@Html.EditorFor(model => model.EndDate, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
你可以使用TextBoxFor,你只需要稍微重写一下:
@Html.TextBoxFor(model => model.EndDate, new { @class = "form-control", @readonly = "readonly" })
这样它会添加您的 form-control
class.
目前我有这个,它是只读的,但我希望它显示为灰色。我需要它作为一个 editorFor 因为我正在使用 bootstrap 并且它看起来比文本框更好。
@Html.EditorFor(model => model.EndDate, new { htmlAttributes = new { @class = "form-control", @readonly = "readonly" } })
你可以使用TextBoxFor,你只需要稍微重写一下:
@Html.TextBoxFor(model => model.EndDate, new { @class = "form-control", @readonly = "readonly" })
这样它会添加您的 form-control
class.