I have marked a property as readonly in the model class, like this:
public class RegisterModel
{
[Display(Name = \"User name\")]
[Re
ReadOnly
attribute doesn't block the HMTL helper to display the field as an enabled input. It is an information that the only the MVC data Binder will respect.
It means that RegisterModel
instance, which will be posted back after form submission by a user, will always has null
value on it's UserName
property, regardless of user's input in the appropriate field of the form.