【发布时间】:2013-06-26 06:15:46
【问题描述】:
我正在 MVC 4 中开发,我想要一个只读文本框。我决定使用@Html.DisplayFor 但我无法让它显示在客户端?
<div class="editor-label">
@Html.LabelFor(model => model.GoodsModel.SerialNumber) <label id ="VGoodsSerialNumber" style="color: #FF0000;"/>
</div>
<div class="editor-field">
@Html.DisplayFor(model => model.GoodsModel.SerialNumber)
@*@Html.EditorFor(model => model.GoodsModel.SerialNumber, new { disabled = "disabled", @readonly = "readonly" })*@
</div>
那我跑的时候找不到?
【问题讨论】:
-
谢谢,仍然无法将 EditorFor 呈现为只读。
-
你有模型类型的模板吗?