title: How to append a custom HTML attribute or CSS class using a .NET data annotation attribute?
body: <p>I'm using ASP.NET MVC 3 RTM. Is it possible to change the HTML rendered from a View Model, by using an attribute?</p>
  
  <p>Example:</p>
  
  <pre><code>public class Product
  {
      [AddHtmlAttribute(Name = "disabled", Value = "disabled")]
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>I want the attribute to be able to change the rendered HTML, that property results in. I know it properly can't be done with an attribute alone. I probably have to hook into the system by implementing an interface, but where should I look?</p>
  
  <p>I know MVC uses the default editor templates, and I've looked at them in the MVC 3 source code, but  I haven't been able to figure out if it would be possible to somehow hook into the rendered  element and add some attributes. I know the validation system does this, by adding custom HTML attributes to support unobtrusive validation.</p>
  
  <p>I guess I just need a pointer to where I should look, or what interface I should take a look at.</p>
  
  <p>Thank you so much.</p>
  
  <p><strong>Update:</strong> I'm using the standard HTML helper <code>Html.EditorFor(model =&gt; model.Name)</code> for my fields, and haven't overriden any editor templates. I would really prefer if I didn't have to change or override the default templates.</p>