I have marked a property as readonly in the model class, like this:
public class RegisterModel
{
[Display(Name = \"User name\")]
[Re
[Update] I don't think it is possible without new { @readonly = "readonly" }
.Readonly
property specifies whether the property this attribute is bound to is read-only or read/write. Details Here.
But you could try for Custom Helpers or try Using Editable
instead Readonly
on the model and use the metadata property in your View.
[Editable(false)]
I guess you have already looked into Does ReadOnly(true) work with Html.EditorForModel?
also a fine article odetocode.com