Custom EditorFor Template and htmlAttributes
问题 I'm trying to use EditorFor custom templates. I want to create a Int32 and decimal templates to render the inputs with some validations. This is what I'm trying @model int? @Html.TextBoxFor(model => model, null, new { @type="text", @oninput = "this.value=this.value.replace(/[^0-9]/g,'')" } ) And I call it like @Html.EditorFor(x => x.ExampleIntField) It renders an <input type="text", oninput="this.value=this.value.replace(/[^0-9]/g,'')" To here everything works, but when I try to pass extra