I have marked a property as readonly in the model class, like this:
public class RegisterModel { [Display(Name = \"User name\")] [Re
ReadOnly attribute does not set the input to read-only.
Try this
Html.TextBoxFor(x => x.UserName, new { readonly = "readonly" })