MVC3 EditorFor readOnly

前端 未结 12 1706
谎友^
谎友^ 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 09:52

    Old post I know.. but now you can do this to keep alignment and all looking consistent..

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

提交回复
热议问题