asp.net mvc - MVC3 : How to force empty field to update as 0 during UpdateModel -
update: part of reason question traced bad database design. had allowed myself talked design in turn led poor choices ui design. decided go , refactor db design, removed problem on ui. therefore, question moot , won't accepting answer. can't delete question because there answers , comments. is there anyway cause mvc3 / ef treat empty form field zero? is, if user leaves field blank, or blanks out field, want ef treat zero, , not null value. i know how make work string fields using data annotations, can't make work integer fields. i hope question makes sense. i've been fiddling data annotations, custom validators, blah blah blah, morning , can't seem make work. this kind of work around.you can make input field 0 if empty before posting form data when user clicks submit button in form . can use javascript