title: ASP.NET MVC: 'Extend' Html.TextBox to conditionally have CSS value?
body: <p>I would like to extend ASP.NET MVC's TextBox so it conditionally switches its CSS value (based on data from the Model). However, I don't want to put that logic in my view (by conditionally changing htmlAttributes/via method call there), but instead extend the class so I don't clutter my view. Basically I want the TextBox on creation look at the Model to see if it has a dictionary entry with its own name, and then look up the associated CSS value if it finds it.</p>
  
  <p>The problems I encounter are: </p>
  
  <p>1) How do I extend it? The TextBox itself is already an extension method and not a class so I can't "inherit"? </p>
  
  <p>2) How would I communicate the conditions affecting the TextBox's attributes from my controller method to the TextBox?</p>