ASP.NET MVC 3: Override "name" attribute with TextBoxFor

EditorFor has an overload where you can supply the name attribute as a parameter:

 @Html.EditorFor(expression, null, name)

Rob, actually there is a much simpler way. Instead of name, use Name:

@Html.TextBoxFor(x => x.Data, new { Name = Model.Key + "_Data", id = Model.Key + "_Data" })

Are you asking this because you want to apply a prefix to the name? If so, you can do this by setting ViewData.TemplateInfo.HtmlFieldPrefix in your Controller.

I learnt a lot about this stuff from Brad Wilson's blog.