MVC3 EditorFor readOnly

前端 未结 12 1656
谎友^
谎友^ 2020-12-05 09:04

I want to make readOnly with EditorFor in edit page.

I tried to put readonly and disabled as:

@Html.Editor
12条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 10:07

    You can do it this way:

    @Html.EditorFor(m => m.userName, new { htmlAttributes = new { disabled = true } })
    

提交回复
热议问题