@Html.TextBoxFor(model => model.Name, new { @readonly="readonly"})
//切记后面匿名对象不要直接写
readonly="readonly",因为
readonly是关键字,一定加上“
@”符号。
@Html.TextBoxFor(model => model.Name, new { disabled = "disabled " })
@Html.TextBoxFor(model => model.Name, new { disabled = "" })
另外EditorFor不能设置只读,需要改成TextBoxFor才行