MVC3 EditorFor readOnly
问题 I want to make readOnly with EditorFor in edit page. I tried to put readonly and disabled as: <div class="editor-field"> @Html.EditorFor(model => model.userName, new { disabled = "disabled", @readonly = "readonly" }) </div> However, it does not work. How can I make to disable edit this field? Thank you. 回答1: The EditorFor html helper does not have overloads that take HTML attributes. In this case, you need to use something more specific like TextBoxFor: <div class="editor-field"> @Html