The following statement:
<%= Html.EditorFor(model => model.Material.Serial) %>
Generates the following code;
<div class="editor-field">
<input type="text" value="" name="Material.Serial" id="Material_Serial" class="input-validation-error">
<span id="Material_Serial_validationMessage" class="field-validation-error">Debe ingresar un serial</span>
</div>
I want to add an onkeypress
javascript attribute to my input through the EditorFor
statement, I have tried to do the following:
<%= Html.EditorFor(model => model.Material.Serial, new{ onkeypress = "return disableEnterKey(event)"})%>
But this doesn't work.