I have a form in an MVC view which contains a number of text boxes, drop down lists and text areas. I am using the HTML helper to create these controls, including pre-populating them with View Data where appropriate, and applying styles via the htmlAttributes parameter.
This is working fine with TextBox controls and DropDownLists etc, however when I add the htmlAttributes to the TextArea it stops working, claiming that the best overloaded method has some invalid arguments, the code that is failing is:
Html.TextArea("Description", ViewData["Description_Current"], new { @class = "DataEntryStd_TextArea" })
The resulting error is:
'System.Web.Mvc.HtmlHelper' does not contain a definition for 'TextArea' and the best extension method overload 'System.Web.Mvc.Html.TextAreaExtensions.TextArea(System.Web.Mvc.HtmlHelper, string, string, object)' has some invalid arguments
For comparison the TextBox calls that are working fine are:
Html.TextBox("TelephoneNumberAlternate", ViewData["TelephoneNumberAlternate"], new { @class = "DataEntryStd_TextBox" })
I tried explicitly referencing the TextAreaExtensions.TextArea and including the HtmlHelper argument however this made no difference.
For info the TextArea call works fine without the htmlAttributes parameter. Additionally I have tried specifying a name/value dictionary for the class attribute however this suffers the exact same problem.
Any ideas what I'm doing wrong?