title: ReadOnly attribute doesn't work in ASP.NET MVC Models
body: <p>I have marked a property as <strong>readonly</strong> in the model class, like this:</p>
  
  <pre><code>public class RegisterModel
  {
      [Display(Name = "User name")]
      [ReadOnly(true)]
      public string UserName { get; set; }
      ...
  }
  </code></pre>
  
  <p>and in my view:</p>
  
  <pre><code>@Html.EditorFor(m =&gt; m.UserName)
  </code></pre>
  
  <p>but when I run the application, the textbox <strong>is not</strong> readonly.</p>
  
  <p>I know I can use html attributes in the view to make it readonly, but I would prefer if this can be done in the model class itself.</p>
  
  <p>Can it be achieved?</p>