ASPNET MVC - Override Html.TextBoxFor(model.property) with a new helper with same signature?
- 阅读更多 关于 ASPNET MVC - Override Html.TextBoxFor(model.property) with a new helper with same signature?
问题 I want to override Html.TextBoxFor() with my own helper that has the exact same signature (but a different namespace of course) - is this possible, and if so, how? The reason for this is that I have 100+ views in an already existing app, and I want to change the behaviour of TextBoxFor so that it outputs a maxLength=n attribute if the property has a [StringLength(n)] annotation. The code for automatically outputting maxlength=n is in this question: maxlength attribute of a text box from the