EditorFor() and html properties
问题 Asp.Net MVC 2.0 preview builds provide helpers like Html.EditorFor(c => c.propertyname) If the property name is string, the above code renders a texbox. What if I want to pass in MaxLength and Size properties to the text box or my own css class property? Do I need to create one template for each size and length combinations in my application? If so, that doesn\'t make the default templates that usable. 回答1: In MVC3, you can set width as follows: @Html.TextBoxFor(c => c.PropertyName, new {