asp.net mvc 2 - Default ModelBinding converts int field to 0 every time -
asp.net mvc 2 - Default ModelBinding converts int field to 0 every time -
i have model looks this:
[serializable] public class question : ratingitem, iquestion, ixmlserializable { // ... public int textrows { get; set; }
and when send controller via post, fiddler captured this:
...question.textrows=44...
but on first line in controller break point says value 0.
[httppost] [requiresresource(securityconstants.individualoverview_configuration, eactions.addnew | eactions.update)] public actionresult save(int documentid, string evaluationvariablename, question question) {
// question.textrows 0 here ...
any guesses going on?
i inherited code, don't see custom model binders adjusting things.
what's weirder other properties percolate controller fine.
well, it's hard without seeing view, binding errors universally related bad field names in form. example, based on code you've shown, shouldn't have field named question.textrows
, rather textrows
. modelbinder understand needs set in instance of question
, pass question
param.
asp.net-mvc-2 .net-4.0 model-binding
Comments
Post a Comment