I have a model like so:
class Model {
public IList<Item> Items { get; set; }
}
class Item { public int Id { get; set; } }
I am sending a request to an action method that takes a Model as a parameter. The request contains the following key-value pair: "Items=" (i. e.
Items=null
). The default model binder sets Items to be a list of 1 null
item, where I want the list property itself to be null
(or at least empty).
Is there any way to accomplish this?
Obviously, I could do some sort of custom model binding, but I'd prefer a solution that would work using the default model binder (perhaps modifying the formatting of the request).
Items
if it's empty? Can we see the AJAX request code? – Goren