Updatemodel error when deleting list item

I have an edit page to edit some information. the page fills a complex object. one of the properties of this object is the general list.

If I just edit the info and save the updatemodel works fine. if i delete (i do it using jquery to remove client side of form elements) something from the list the updatemodel fails with "object not instantiated".

My guess is that the update model expects the list to stay the same length or whatever, but can't find any information on this, any ideas?

+1


source to share


2 answers


The model binder will try to match properties of complex objects receiving data:
1) values ​​from RouteData
2) URI query string
3) claim form query
Check this place to see why your property is null. If you delete your form elements, your property will not receive any data. Some info here and Scott Hanselman's bug analysis here .



0


source


OK, figured out the problem (and it was of course a programmer error) in the jquery delete routine. I removed all items. EXCLUDES the hidden field that the binder uses for lists :(



+1


source







All Articles