@Html.EditFor()不能添加“只读”html属性;以及disable属性的坑

要改为:

@Html.TextBoxFor(model => model.Member_Name, new {@readonly="readonly", style="background-color:#c1b7b7"})

注意:如果使用了disabled=“disabled”属性,那么,无论是在<input>,还是在@Html.TextBoxFor()中使用,post页面时,控制器都收不到他们对应的值,比如:

@Html.TextBoxFor(model => model.Member_Name, new {@disabled=“disabled”, style="background-color:#c1b7b7"}),则post时,控制器接受到的Member_Name的值为 null

原文地址:https://www.cnblogs.com/tider1999/p/4217258.html