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

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -